From e213ce71e3976fcb7a397dfa44a673330f6da8d6 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Tue, 5 Dec 2023 16:59:08 -0600 Subject: [PATCH] rust: rustfmt --- rust/derive/src/applayerevent.rs | 4 +- rust/src/applayer.rs | 307 +- rust/src/applayertemplate/logger.rs | 2 +- rust/src/applayertemplate/template.rs | 32 +- rust/src/asn1/mod.rs | 12 +- rust/src/asn1/parse_rules.rs | 14 +- rust/src/bittorrent_dht/bittorrent_dht.rs | 54 +- rust/src/bittorrent_dht/logger.rs | 2 +- rust/src/common.rs | 8 +- rust/src/conf.rs | 78 +- rust/src/core.rs | 189 +- rust/src/dcerpc/dcerpc.rs | 250 +- rust/src/dcerpc/dcerpc_udp.rs | 125 +- rust/src/dcerpc/detect.rs | 12 +- rust/src/dcerpc/log.rs | 8 +- rust/src/dcerpc/mod.rs | 2 +- rust/src/dcerpc/parser.rs | 36 +- rust/src/detect/byte_math.rs | 232 +- rust/src/detect/iprep.rs | 6 +- rust/src/detect/stream_size.rs | 4 +- rust/src/detect/uint.rs | 28 +- rust/src/detect/uri.rs | 4 +- rust/src/dhcp/detect.rs | 12 +- rust/src/dhcp/dhcp.rs | 100 +- rust/src/dhcp/logger.rs | 174 +- rust/src/dhcp/mod.rs | 4 +- rust/src/dns/detect.rs | 70 +- rust/src/dns/dns.rs | 52 +- rust/src/dns/log.rs | 21 +- rust/src/dns/lua.rs | 16 +- rust/src/ffi/base64.rs | 6 +- rust/src/ffi/hashing.rs | 62 +- rust/src/ffi/mod.rs | 2 +- rust/src/filecontainer.rs | 77 +- rust/src/filetracker.rs | 121 +- rust/src/frames.rs | 9 +- rust/src/ftp/event.rs | 4 +- rust/src/ftp/mod.rs | 8 +- rust/src/http2/decompression.rs | 6 +- rust/src/http2/detect.rs | 76 +- rust/src/http2/http2.rs | 86 +- rust/src/http2/logger.rs | 7 +- rust/src/http2/parser.rs | 5 +- rust/src/http2/range.rs | 35 +- rust/src/ike/detect.rs | 18 +- rust/src/ike/ike.rs | 40 +- rust/src/ike/ikev1.rs | 8 +- rust/src/ike/ikev2.rs | 6 +- rust/src/ike/logger.rs | 2 +- rust/src/ike/parser.rs | 19 +- rust/src/jsonbuilder.rs | 62 +- rust/src/kerberos.rs | 17 +- rust/src/krb/detect.rs | 15 +- rust/src/krb/krb5.rs | 327 +- rust/src/krb/log.rs | 27 +- rust/src/krb/mod.rs | 2 +- rust/src/lib.rs | 46 +- rust/src/log.rs | 57 +- rust/src/lua.rs | 1 - rust/src/lzma.rs | 2 +- rust/src/mime/mod.rs | 14 +- rust/src/modbus/detect.rs | 6 +- rust/src/modbus/log.rs | 2 +- rust/src/modbus/modbus.rs | 73 +- rust/src/mqtt/detect.rs | 116 +- rust/src/mqtt/logger.rs | 2 +- rust/src/mqtt/mqtt.rs | 42 +- rust/src/mqtt/parser.rs | 16 +- rust/src/nfs/log.rs | 63 +- rust/src/nfs/mod.rs | 14 +- rust/src/nfs/nfs.rs | 1174 ++-- rust/src/nfs/nfs2.rs | 54 +- rust/src/nfs/nfs2_records.rs | 14 +- rust/src/nfs/nfs3.rs | 63 +- rust/src/nfs/nfs3_records.rs | 46 +- rust/src/nfs/nfs4.rs | 37 +- rust/src/nfs/nfs4_records.rs | 533 +- rust/src/nfs/nfs_records.rs | 6 +- rust/src/nfs/rpc_records.rs | 46 +- rust/src/nfs/types.rs | 436 +- rust/src/ntp/ntp.rs | 169 +- rust/src/pgsql/logger.rs | 2 +- rust/src/pgsql/parser.rs | 690 +- rust/src/pgsql/pgsql.rs | 29 +- rust/src/quic/detect.rs | 12 +- rust/src/quic/frames.rs | 3 +- rust/src/quic/logger.rs | 4 +- rust/src/quic/quic.rs | 38 +- rust/src/rdp/log.rs | 4 +- rust/src/rdp/parser.rs | 84 +- rust/src/rdp/rdp.rs | 28 +- rust/src/rfb/detect.rs | 8 +- rust/src/rfb/logger.rs | 2 +- rust/src/rfb/rfb.rs | 18 +- rust/src/sip/detect.rs | 43 +- rust/src/sip/log.rs | 4 +- rust/src/sip/sip.rs | 99 +- rust/src/smb/auth.rs | 164 +- rust/src/smb/dcerpc.rs | 305 +- rust/src/smb/dcerpc_records.rs | 77 +- rust/src/smb/debug.rs | 42 +- rust/src/smb/detect.rs | 77 +- rust/src/smb/files.rs | 96 +- rust/src/smb/funcs.rs | 13 +- rust/src/smb/log.rs | 159 +- rust/src/smb/mod.rs | 30 +- rust/src/smb/nbss_records.rs | 98 +- rust/src/smb/session.rs | 24 +- rust/src/smb/smb.rs | 1641 +++-- rust/src/smb/smb1.rs | 941 +-- rust/src/smb/smb1_records.rs | 511 +- rust/src/smb/smb1_session.rs | 146 +- rust/src/smb/smb2.rs | 732 +- rust/src/smb/smb2_ioctl.rs | 61 +- rust/src/smb/smb2_session.rs | 50 +- rust/src/smb/smb3.rs | 8 +- rust/src/smb/smb_records.rs | 10 +- rust/src/smb/smb_status.rs | 7716 +++++++++++---------- rust/src/snmp/detect.rs | 12 +- rust/src/snmp/log.rs | 14 +- rust/src/snmp/mod.rs | 4 +- rust/src/snmp/snmp.rs | 234 +- rust/src/ssh/detect.rs | 18 +- rust/src/ssh/logger.rs | 2 +- rust/src/ssh/parser.rs | 757 +- rust/src/ssh/ssh.rs | 72 +- rust/src/telnet/mod.rs | 2 +- rust/src/telnet/parser.rs | 12 +- rust/src/telnet/telnet.rs | 127 +- rust/src/tftp/log.rs | 12 +- rust/src/tftp/mod.rs | 2 +- rust/src/tftp/tftp.rs | 109 +- rust/src/util.rs | 2 +- rust/src/x509/log.rs | 2 +- rust/src/x509/mod.rs | 22 +- rust/src/x509/time.rs | 2 +- 136 files changed, 11697 insertions(+), 9614 deletions(-) diff --git a/rust/derive/src/applayerevent.rs b/rust/derive/src/applayerevent.rs index 29475fa2d51b..3c6a236ec6af 100644 --- a/rust/derive/src/applayerevent.rs +++ b/rust/derive/src/applayerevent.rs @@ -51,7 +51,9 @@ pub fn derive_app_layer_event(input: TokenStream) -> TokenStream { // "crate", but if we're being used by a library or plugin user we need to reference the // Suricata name space as "suricata". Check the CARGO_PKG_NAME environment variable to // determine what identifier to setup. - let is_suricata = std::env::var("CARGO_PKG_NAME").map(|var| var == "suricata").unwrap_or(false); + let is_suricata = std::env::var("CARGO_PKG_NAME") + .map(|var| var == "suricata") + .unwrap_or(false); let crate_id = if is_suricata { syn::Ident::new("crate", proc_macro2::Span::call_site()) } else { diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 97db321e2249..8f3871b676c1 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -17,13 +17,13 @@ //! Parser registration functions and common interface module. -use std; -use crate::core::{self,DetectEngineState,Flow,AppLayerEventType,AppProto,Direction}; -use crate::filecontainer::FileContainer; -use std::os::raw::{c_void,c_char,c_int}; +use crate::core::StreamingBufferConfig; use crate::core::SC; +use crate::core::{self, AppLayerEventType, AppProto, DetectEngineState, Direction, Flow}; +use crate::filecontainer::FileContainer; +use std; use std::ffi::CStr; -use crate::core::StreamingBufferConfig; +use std::os::raw::{c_char, c_int, c_void}; // Make the AppLayerEvent derive macro available to users importing // AppLayerEvent from this module. @@ -39,7 +39,6 @@ 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 { @@ -47,7 +46,7 @@ impl StreamSlice { input: slice.as_ptr(), input_len: slice.len() as u32, flags, - offset + offset, } } @@ -75,7 +74,7 @@ impl StreamSlice { } #[repr(C)] -#[derive(Default, Debug,PartialEq, Eq)] +#[derive(Default, Debug, PartialEq, Eq)] pub struct AppLayerTxConfig { /// config: log flags log_flags: u8, @@ -83,9 +82,7 @@ pub struct AppLayerTxConfig { impl AppLayerTxConfig { pub fn new() -> Self { - Self { - log_flags: 0, - } + Self { log_flags: 0 } } } @@ -192,54 +189,56 @@ impl AppLayerTxData { pub fn update_file_flags(&mut self, state_flags: u16) { if (self.file_flags & state_flags) != state_flags { - SCLogDebug!("updating tx file_flags {:04x} with state flags {:04x}", self.file_flags, state_flags); + SCLogDebug!( + "updating tx file_flags {:04x} with state flags {:04x}", + self.file_flags, + state_flags + ); self.file_flags |= state_flags; } } } #[macro_export] -macro_rules!export_tx_data_get { +macro_rules! export_tx_data_get { ($name:ident, $type:ty) => { #[no_mangle] - pub unsafe extern "C" fn $name(tx: *mut std::os::raw::c_void) - -> *mut $crate::applayer::AppLayerTxData - { + pub unsafe extern fn $name( + tx: *mut std::os::raw::c_void, + ) -> *mut $crate::applayer::AppLayerTxData { let tx = &mut *(tx as *mut $type); &mut tx.tx_data } - } + }; } #[repr(C)] -#[derive(Default,Debug,PartialEq, Eq,Copy,Clone)] +#[derive(Default, Debug, PartialEq, Eq, Copy, Clone)] pub struct AppLayerStateData { pub file_flags: u16, } impl AppLayerStateData { pub fn new() -> Self { - Self { - file_flags: 0, - } + Self { file_flags: 0 } } } #[macro_export] -macro_rules!export_state_data_get { +macro_rules! export_state_data_get { ($name:ident, $type:ty) => { #[no_mangle] - pub unsafe extern "C" fn $name(state: *mut std::os::raw::c_void) - -> *mut $crate::applayer::AppLayerStateData - { + pub unsafe extern fn $name( + state: *mut std::os::raw::c_void, + ) -> *mut $crate::applayer::AppLayerStateData { let state = &mut *(state as *mut $type); &mut state.state_data } - } + }; } #[repr(C)] -#[derive(Default,Debug,PartialEq, Eq,Copy,Clone)] +#[derive(Default, Debug, PartialEq, Eq, Copy, Clone)] pub struct AppLayerResult { pub status: i32, pub consumed: u32, @@ -301,60 +300,60 @@ impl From for AppLayerResult { #[repr(C)] pub struct RustParser { /// Parser name. - pub name: *const c_char, + pub name: *const c_char, /// Default port - pub default_port: *const c_char, + pub default_port: *const c_char, /// IP Protocol (core::IPPROTO_UDP, core::IPPROTO_TCP, etc.) - pub ipproto: u8, + pub ipproto: u8, /// Probing function, for packets going to server - pub probe_ts: Option, + pub probe_ts: Option, /// Probing function, for packets going to client - pub probe_tc: Option, + pub probe_tc: Option, /// Minimum frame depth for probing - pub min_depth: u16, + pub min_depth: u16, /// Maximum frame depth for probing - pub max_depth: u16, + pub max_depth: u16, /// Allocation function for a new state - pub state_new: StateAllocFn, + pub state_new: StateAllocFn, /// Function called to free a state - pub state_free: StateFreeFn, + pub state_free: StateFreeFn, /// Parsing function, for packets going to server - pub parse_ts: ParseFn, + pub parse_ts: ParseFn, /// Parsing function, for packets going to client - pub parse_tc: ParseFn, + pub parse_tc: ParseFn, /// Get the current transaction count - pub get_tx_count: StateGetTxCntFn, + pub get_tx_count: StateGetTxCntFn, /// Get a transaction - pub get_tx: StateGetTxFn, + pub get_tx: StateGetTxFn, /// Function called to free a transaction - pub tx_free: StateTxFreeFn, + pub tx_free: StateTxFreeFn, /// Progress values at which the tx is considered complete in a direction - pub tx_comp_st_ts: c_int, - pub tx_comp_st_tc: c_int, + pub tx_comp_st_ts: c_int, + pub tx_comp_st_tc: c_int, /// Function returning the current transaction progress - pub tx_get_progress: StateGetProgressFn, + pub tx_get_progress: StateGetProgressFn, /// Function to get an event id from a description - pub get_eventinfo: Option, + pub get_eventinfo: Option, /// Function to get an event description from an event id pub get_eventinfo_byid: Option, /// Function to allocate local storage - pub localstorage_new: Option, + pub localstorage_new: Option, /// Function to free local storage - pub localstorage_free: Option, + pub localstorage_free: Option, /// Function to get files - pub get_tx_files: Option, + pub get_tx_files: Option, /// Function to get the TX iterator - pub get_tx_iterator: Option, + pub get_tx_iterator: Option, pub get_state_data: GetStateDataFn, pub get_tx_data: GetTxDataFn, @@ -380,7 +379,9 @@ pub struct RustParser { /// UNSAFE ! #[macro_export] macro_rules! build_slice { - ($buf:ident, $len:expr) => ( std::slice::from_raw_parts($buf, $len) ); + ($buf:ident, $len:expr) => { + std::slice::from_raw_parts($buf, $len) + }; } /// Cast pointer to a variable, as a mutable reference to an object @@ -388,7 +389,9 @@ macro_rules! build_slice { /// UNSAFE ! #[macro_export] macro_rules! cast_pointer { - ($ptr:ident, $ty:ty) => ( &mut *($ptr as *mut $ty) ); + ($ptr:ident, $ty:ty) => { + &mut *($ptr as *mut $ty) + }; } /// helper for the GetTxFilesFn. Not meant to be embedded as the config @@ -401,44 +404,60 @@ pub struct AppLayerGetFileState { } impl AppLayerGetFileState { pub fn err() -> AppLayerGetFileState { - AppLayerGetFileState { fc: std::ptr::null_mut(), cfg: std::ptr::null() } - } -} - -pub type ParseFn = unsafe extern "C" fn (flow: *const Flow, - state: *mut c_void, - pstate: *mut c_void, - stream_slice: StreamSlice, - data: *const c_void) -> AppLayerResult; -pub type ProbeFn = unsafe extern "C" fn (flow: *const Flow, flags: u8, input:*const u8, input_len: u32, rdir: *mut u8) -> AppProto; -pub type StateAllocFn = extern "C" fn (*mut c_void, AppProto) -> *mut c_void; -pub type StateFreeFn = unsafe extern "C" fn (*mut c_void); -pub type StateTxFreeFn = unsafe extern "C" fn (*mut c_void, u64); -pub type StateGetTxFn = unsafe extern "C" fn (*mut c_void, u64) -> *mut c_void; -pub type StateGetTxCntFn = unsafe extern "C" fn (*mut c_void) -> u64; -pub type StateGetProgressFn = unsafe extern "C" fn (*mut c_void, u8) -> c_int; -pub type GetEventInfoFn = unsafe extern "C" fn (*const c_char, *mut c_int, *mut AppLayerEventType) -> c_int; -pub type GetEventInfoByIdFn = unsafe extern "C" fn (c_int, *mut *const c_char, *mut AppLayerEventType) -> i8; -pub type LocalStorageNewFn = extern "C" fn () -> *mut c_void; -pub type LocalStorageFreeFn = extern "C" fn (*mut c_void); -pub type GetTxFilesFn = unsafe extern "C" fn (*mut c_void, *mut c_void, u8) -> AppLayerGetFileState; -pub type GetTxIteratorFn = unsafe extern "C" fn (ipproto: u8, alproto: AppProto, - state: *mut c_void, - min_tx_id: u64, - max_tx_id: u64, - istate: &mut u64) - -> AppLayerGetTxIterTuple; -pub type GetTxDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerTxData; -pub type GetStateDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerStateData; -pub type ApplyTxConfigFn = unsafe extern "C" fn (*mut c_void, *mut c_void, c_int, AppLayerTxConfig); -pub type TruncateFn = unsafe extern "C" fn (*mut c_void, u8); -pub type GetFrameIdByName = unsafe extern "C" fn(*const c_char) -> c_int; -pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char; + AppLayerGetFileState { + fc: std::ptr::null_mut(), + cfg: std::ptr::null(), + } + } +} +pub type ParseFn = unsafe extern fn( + flow: *const Flow, + state: *mut c_void, + pstate: *mut c_void, + stream_slice: StreamSlice, + data: *const c_void, +) -> AppLayerResult; +pub type ProbeFn = unsafe extern fn( + flow: *const Flow, + flags: u8, + input: *const u8, + input_len: u32, + rdir: *mut u8, +) -> AppProto; +pub type StateAllocFn = extern fn(*mut c_void, AppProto) -> *mut c_void; +pub type StateFreeFn = unsafe extern fn(*mut c_void); +pub type StateTxFreeFn = unsafe extern fn(*mut c_void, u64); +pub type StateGetTxFn = unsafe extern fn(*mut c_void, u64) -> *mut c_void; +pub type StateGetTxCntFn = unsafe extern fn(*mut c_void) -> u64; +pub type StateGetProgressFn = unsafe extern fn(*mut c_void, u8) -> c_int; +pub type GetEventInfoFn = + unsafe extern fn(*const c_char, *mut c_int, *mut AppLayerEventType) -> c_int; +pub type GetEventInfoByIdFn = + unsafe extern fn(c_int, *mut *const c_char, *mut AppLayerEventType) -> i8; +pub type LocalStorageNewFn = extern fn() -> *mut c_void; +pub type LocalStorageFreeFn = extern fn(*mut c_void); +pub type GetTxFilesFn = unsafe extern fn(*mut c_void, *mut c_void, u8) -> AppLayerGetFileState; +pub type GetTxIteratorFn = unsafe extern fn( + ipproto: u8, + alproto: AppProto, + state: *mut c_void, + min_tx_id: u64, + max_tx_id: u64, + istate: &mut u64, +) -> AppLayerGetTxIterTuple; +pub type GetTxDataFn = unsafe extern fn(*mut c_void) -> *mut AppLayerTxData; +pub type GetStateDataFn = unsafe extern fn(*mut c_void) -> *mut AppLayerStateData; +pub type ApplyTxConfigFn = unsafe extern fn(*mut c_void, *mut c_void, c_int, AppLayerTxConfig); +pub type TruncateFn = unsafe extern fn(*mut c_void, u8); +pub type GetFrameIdByName = unsafe extern fn(*const c_char) -> c_int; +pub type GetFrameNameById = unsafe extern fn(u8) -> *const c_char; // Defined in app-layer-register.h extern { - pub fn AppLayerRegisterProtocolDetection(parser: *const RustParser, enable_default: c_int) -> AppProto; + pub fn AppLayerRegisterProtocolDetection( + parser: *const RustParser, enable_default: c_int, + ) -> AppProto; pub fn AppLayerRegisterParserAlias(parser_name: *const c_char, alias_name: *const c_char); } @@ -449,34 +468,40 @@ pub unsafe fn AppLayerRegisterParser(parser: *const RustParser, alproto: AppProt // Defined in app-layer-detect-proto.h extern { - pub fn AppLayerProtoDetectPPRegister(ipproto: u8, portstr: *const c_char, alproto: AppProto, - min_depth: u16, max_depth: u16, dir: u8, - pparser1: ProbeFn, pparser2: ProbeFn); - pub fn AppLayerProtoDetectPPParseConfPorts(ipproto_name: *const c_char, ipproto: u8, - alproto_name: *const c_char, alproto: AppProto, - min_depth: u16, max_depth: u16, - pparser_ts: ProbeFn, pparser_tc: ProbeFn) -> i32; - pub fn AppLayerProtoDetectPMRegisterPatternCS(ipproto: u8, alproto: AppProto, - pattern: *const c_char, depth: u16, - offset: u16, direction: u8) -> c_int; - pub fn AppLayerProtoDetectPMRegisterPatternCSwPP(ipproto: u8, alproto: AppProto, - pattern: *const c_char, depth: u16, - offset: u16, direction: u8, ppfn: ProbeFn, - pp_min_depth: u16, pp_max_depth: u16) -> c_int; - pub fn AppLayerProtoDetectConfProtoDetectionEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int; - pub fn AppLayerProtoDetectConfProtoDetectionEnabledDefault(ipproto: *const c_char, proto: *const c_char, default: bool) -> c_int; + pub fn AppLayerProtoDetectPPRegister( + ipproto: u8, portstr: *const c_char, alproto: AppProto, min_depth: u16, max_depth: u16, + dir: u8, pparser1: ProbeFn, pparser2: ProbeFn, + ); + pub fn AppLayerProtoDetectPPParseConfPorts( + ipproto_name: *const c_char, ipproto: u8, alproto_name: *const c_char, alproto: AppProto, + min_depth: u16, max_depth: u16, pparser_ts: ProbeFn, pparser_tc: ProbeFn, + ) -> i32; + pub fn AppLayerProtoDetectPMRegisterPatternCS( + ipproto: u8, alproto: AppProto, pattern: *const c_char, depth: u16, offset: u16, + direction: u8, + ) -> c_int; + pub fn AppLayerProtoDetectPMRegisterPatternCSwPP( + ipproto: u8, alproto: AppProto, pattern: *const c_char, depth: u16, offset: u16, + direction: u8, ppfn: ProbeFn, pp_min_depth: u16, pp_max_depth: u16, + ) -> c_int; + pub fn AppLayerProtoDetectConfProtoDetectionEnabled( + ipproto: *const c_char, proto: *const c_char, + ) -> c_int; + pub fn AppLayerProtoDetectConfProtoDetectionEnabledDefault( + ipproto: *const c_char, proto: *const c_char, default: bool, + ) -> c_int; pub fn AppLayerRequestProtocolTLSUpgrade(flow: *const Flow) -> bool; } // Defined in app-layer-parser.h -pub const APP_LAYER_PARSER_NO_INSPECTION : u16 = BIT_U16!(1); -pub const APP_LAYER_PARSER_NO_REASSEMBLY : u16 = BIT_U16!(2); -pub const APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD : u16 = BIT_U16!(3); -pub const APP_LAYER_PARSER_BYPASS_READY : u16 = BIT_U16!(4); -pub const APP_LAYER_PARSER_EOF_TS : u16 = BIT_U16!(5); -pub const APP_LAYER_PARSER_EOF_TC : u16 = BIT_U16!(6); -pub const APP_LAYER_PARSER_TRUNC_TS : u16 = BIT_U16!(7); -pub const APP_LAYER_PARSER_TRUNC_TC : u16 = BIT_U16!(8); +pub const APP_LAYER_PARSER_NO_INSPECTION: u16 = BIT_U16!(1); +pub const APP_LAYER_PARSER_NO_REASSEMBLY: u16 = BIT_U16!(2); +pub const APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD: u16 = BIT_U16!(3); +pub const APP_LAYER_PARSER_BYPASS_READY: u16 = BIT_U16!(4); +pub const APP_LAYER_PARSER_EOF_TS: u16 = BIT_U16!(5); +pub const APP_LAYER_PARSER_EOF_TC: u16 = BIT_U16!(6); +pub const APP_LAYER_PARSER_TRUNC_TS: u16 = BIT_U16!(7); +pub const APP_LAYER_PARSER_TRUNC_TC: u16 = BIT_U16!(8); pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = BIT_U32!(0); @@ -497,27 +522,32 @@ pub struct AppLayerGetTxIterTuple { } impl AppLayerGetTxIterTuple { - pub fn with_values(tx_ptr: *mut std::os::raw::c_void, tx_id: u64, has_next: bool) -> AppLayerGetTxIterTuple { + pub fn with_values( + tx_ptr: *mut std::os::raw::c_void, tx_id: u64, has_next: bool, + ) -> AppLayerGetTxIterTuple { AppLayerGetTxIterTuple { - tx_ptr, tx_id, has_next, + tx_ptr, + tx_id, + has_next, } } pub fn not_found() -> AppLayerGetTxIterTuple { AppLayerGetTxIterTuple { - tx_ptr: std::ptr::null_mut(), tx_id: 0, has_next: false, + tx_ptr: std::ptr::null_mut(), + tx_id: 0, + has_next: false, } } } /// LoggerFlags tracks which loggers have already been executed. #[repr(C)] -#[derive(Default, Debug,PartialEq, Eq)] +#[derive(Default, Debug, PartialEq, Eq)] pub struct LoggerFlags { flags: u32, } impl LoggerFlags { - pub fn new() -> Self { Default::default() } @@ -529,33 +559,34 @@ impl LoggerFlags { pub fn set(&mut self, bits: u32) { self.flags = bits; } - } /// AppLayerEvent trait that will be implemented on enums that /// derive AppLayerEvent. pub trait AppLayerEvent { /// Return the enum variant of the given ID. - fn from_id(id: i32) -> Option where Self: std::marker::Sized; + fn from_id(id: i32) -> Option + where + Self: std::marker::Sized; /// Convert the enum variant to a C-style string (suffixed with \0). fn to_cstring(&self) -> &str; /// Return the enum variant for the given name. - fn from_string(s: &str) -> Option where Self: std::marker::Sized; + fn from_string(s: &str) -> Option + where + Self: std::marker::Sized; /// Return the ID value of the enum variant. fn as_i32(&self) -> i32; - unsafe extern "C" fn get_event_info( - event_name: *const std::os::raw::c_char, - event_id: *mut std::os::raw::c_int, + unsafe extern fn get_event_info( + event_name: *const std::os::raw::c_char, event_id: *mut std::os::raw::c_int, event_type: *mut core::AppLayerEventType, ) -> std::os::raw::c_int; - unsafe extern "C" fn get_event_info_by_id( - event_id: std::os::raw::c_int, - event_name: *mut *const std::os::raw::c_char, + unsafe extern fn get_event_info_by_id( + event_id: std::os::raw::c_int, event_name: *mut *const std::os::raw::c_char, event_type: *mut core::AppLayerEventType, ) -> i8; } @@ -577,8 +608,7 @@ pub trait AppLayerEvent { /// ``` #[inline(always)] pub unsafe fn get_event_info( - event_name: *const std::os::raw::c_char, - event_id: *mut std::os::raw::c_int, + event_name: *const std::os::raw::c_char, event_id: *mut std::os::raw::c_int, event_type: *mut core::AppLayerEventType, ) -> std::os::raw::c_int { if event_name.is_null() { @@ -598,8 +628,7 @@ pub unsafe fn get_event_info( /// AppLayerEvent. #[inline(always)] pub unsafe fn get_event_info_by_id( - event_id: std::os::raw::c_int, - event_name: *mut *const std::os::raw::c_char, + event_id: std::os::raw::c_int, event_name: *mut *const std::os::raw::c_char, event_type: *mut core::AppLayerEventType, ) -> i8 { if let Some(e) = T::from_id(event_id) { @@ -645,7 +674,7 @@ pub trait State { } } -pub unsafe extern "C" fn state_get_tx_iterator, Tx: Transaction>( +pub unsafe extern fn state_get_tx_iterator, Tx: Transaction>( _ipproto: u8, _alproto: AppProto, state: *mut std::os::raw::c_void, min_tx_id: u64, _max_tx_id: u64, istate: &mut u64, ) -> AppLayerGetTxIterTuple { @@ -669,7 +698,9 @@ pub trait AppLayerFrameType { /// Create a frame type variant from a u8. /// /// None will be returned if there is no matching enum variant. - fn from_u8(value: u8) -> Option where Self: std::marker::Sized; + fn from_u8(value: u8) -> Option + where + Self: std::marker::Sized; /// Return the u8 value of the enum where the first entry has the value of 0. fn as_u8(&self) -> u8; @@ -677,14 +708,19 @@ pub trait AppLayerFrameType { /// Create a frame type variant from a &str. /// /// None will be returned if there is no matching enum variant. - fn from_str(s: &str) -> Option where Self: std::marker::Sized; + fn from_str(s: &str) -> Option + where + Self: std::marker::Sized; /// Return a pointer to a C string of the enum variant suitable as-is for /// FFI. fn to_cstring(&self) -> *const std::os::raw::c_char; /// Converts a C string formatted name to a frame type ID. - unsafe extern "C" fn ffi_id_from_name(name: *const std::os::raw::c_char) -> i32 where Self: Sized { + unsafe extern fn ffi_id_from_name(name: *const std::os::raw::c_char) -> i32 + where + Self: Sized, + { if name.is_null() { return -1; } @@ -697,7 +733,12 @@ pub trait AppLayerFrameType { } /// Converts a variant ID to an FFI safe name. - extern "C" fn ffi_name_from_id(id: u8) -> *const std::os::raw::c_char where Self: Sized { - Self::from_u8(id).map(|s| s.to_cstring()).unwrap_or_else(std::ptr::null) + extern fn ffi_name_from_id(id: u8) -> *const std::os::raw::c_char + where + Self: Sized, + { + Self::from_u8(id) + .map(|s| s.to_cstring()) + .unwrap_or_else(std::ptr::null) } } diff --git a/rust/src/applayertemplate/logger.rs b/rust/src/applayertemplate/logger.rs index 766a07acdb9d..d97c6c50a123 100644 --- a/rust/src/applayertemplate/logger.rs +++ b/rust/src/applayertemplate/logger.rs @@ -32,7 +32,7 @@ fn log_template(tx: &TemplateTransaction, js: &mut JsonBuilder) -> Result<(), Js } #[no_mangle] -pub unsafe extern "C" fn rs_template_logger_log( +pub unsafe extern fn rs_template_logger_log( tx: *mut std::os::raw::c_void, js: &mut JsonBuilder, ) -> bool { let tx = cast_pointer!(tx, TemplateTransaction); diff --git a/rust/src/applayertemplate/template.rs b/rust/src/applayertemplate/template.rs index acc6c26c37fa..21c4d17bb29b 100644 --- a/rust/src/applayertemplate/template.rs +++ b/rust/src/applayertemplate/template.rs @@ -114,7 +114,9 @@ impl TemplateState { } fn find_request(&mut self) -> Option<&mut TemplateTransaction> { - self.transactions.iter_mut().find(|tx| tx.response.is_none()) + self.transactions + .iter_mut() + .find(|tx| tx.response.is_none()) } fn parse_request(&mut self, input: &[u8]) -> AppLayerResult { @@ -188,7 +190,7 @@ impl TemplateState { Ok((rem, response)) => { start = rem; - if let Some(tx) = self.find_request() { + if let Some(tx) = self.find_request() { tx.response = Some(response); SCLogNotice!("Found response for request:"); SCLogNotice!("- Request: {:?}", tx.request); @@ -237,7 +239,7 @@ fn probe(input: &[u8]) -> nom::IResult<&[u8], ()> { // C exports. /// C entry point for a probing parser. -unsafe extern "C" fn rs_template_probing_parser( +unsafe extern fn rs_template_probing_parser( _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { // Need at least 2 bytes. @@ -250,24 +252,22 @@ unsafe extern "C" fn rs_template_probing_parser( return ALPROTO_UNKNOWN; } -extern "C" fn rs_template_state_new( - _orig_state: *mut c_void, _orig_proto: AppProto, -) -> *mut c_void { +extern fn rs_template_state_new(_orig_state: *mut c_void, _orig_proto: AppProto) -> *mut c_void { let state = TemplateState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut c_void; } -unsafe extern "C" fn rs_template_state_free(state: *mut c_void) { +unsafe extern fn rs_template_state_free(state: *mut c_void) { std::mem::drop(Box::from_raw(state as *mut TemplateState)); } -unsafe extern "C" fn rs_template_state_tx_free(state: *mut c_void, tx_id: u64) { +unsafe extern fn rs_template_state_tx_free(state: *mut c_void, tx_id: u64) { let state = cast_pointer!(state, TemplateState); state.free_tx(tx_id); } -unsafe extern "C" fn rs_template_parse_request( +unsafe extern fn rs_template_parse_request( _flow: *const Flow, state: *mut c_void, pstate: *mut c_void, stream_slice: StreamSlice, _data: *const c_void, ) -> AppLayerResult { @@ -291,7 +291,7 @@ unsafe extern "C" fn rs_template_parse_request( } } -unsafe extern "C" fn rs_template_parse_response( +unsafe extern fn rs_template_parse_response( _flow: *const Flow, state: *mut c_void, pstate: *mut c_void, stream_slice: StreamSlice, _data: *const c_void, ) -> AppLayerResult { @@ -309,7 +309,7 @@ unsafe extern "C" fn rs_template_parse_response( } } -unsafe extern "C" fn rs_template_state_get_tx(state: *mut c_void, tx_id: u64) -> *mut c_void { +unsafe extern fn rs_template_state_get_tx(state: *mut c_void, tx_id: u64) -> *mut c_void { let state = cast_pointer!(state, TemplateState); match state.get_tx(tx_id) { Some(tx) => { @@ -321,12 +321,12 @@ unsafe extern "C" fn rs_template_state_get_tx(state: *mut c_void, tx_id: u64) -> } } -unsafe extern "C" fn rs_template_state_get_tx_count(state: *mut c_void) -> u64 { +unsafe extern fn rs_template_state_get_tx_count(state: *mut c_void) -> u64 { let state = cast_pointer!(state, TemplateState); return state.tx_id; } -unsafe extern "C" fn rs_template_tx_get_alstate_progress(tx: *mut c_void, _direction: u8) -> c_int { +unsafe extern fn rs_template_tx_get_alstate_progress(tx: *mut c_void, _direction: u8) -> c_int { let tx = cast_pointer!(tx, TemplateTransaction); // Transaction is done if we have a response. @@ -341,7 +341,7 @@ unsafe extern "C" fn rs_template_tx_get_alstate_progress(tx: *mut c_void, _direc /// No required for parsing, but an example function for retrieving a /// pointer to the request buffer from C for detection. #[no_mangle] -pub unsafe extern "C" fn rs_template_get_request_buffer( +pub unsafe extern fn rs_template_get_request_buffer( tx: *mut c_void, buf: *mut *const u8, len: *mut u32, ) -> u8 { let tx = cast_pointer!(tx, TemplateTransaction); @@ -357,7 +357,7 @@ pub unsafe extern "C" fn rs_template_get_request_buffer( /// Get the response buffer for a transaction from C. #[no_mangle] -pub unsafe extern "C" fn rs_template_get_response_buffer( +pub unsafe extern fn rs_template_get_response_buffer( tx: *mut c_void, buf: *mut *const u8, len: *mut u32, ) -> u8 { let tx = cast_pointer!(tx, TemplateTransaction); @@ -378,7 +378,7 @@ export_state_data_get!(rs_template_get_state_data, TemplateState); const PARSER_NAME: &[u8] = b"template\0"; #[no_mangle] -pub unsafe extern "C" fn rs_template_register_parser() { +pub unsafe extern fn rs_template_register_parser() { /* TEMPLATE_START_REMOVE */ if crate::conf::conf_get_node("app-layer.protocols.template").is_none() { return; diff --git a/rust/src/asn1/mod.rs b/rust/src/asn1/mod.rs index cf382cf6077c..2de79ab0875c 100644 --- a/rust/src/asn1/mod.rs +++ b/rust/src/asn1/mod.rs @@ -107,9 +107,7 @@ impl<'a> Asn1<'a> { && obj.header.is_primitive()) { if let BerObjectContent::BitString(bits, _v) = &obj.content { - if len > 0 - && *bits as usize > len.saturating_mul(8) - { + if len > 0 && *bits as usize > len.saturating_mul(8) { return Some(Asn1Check::BitstringOverflow); } } @@ -217,7 +215,7 @@ fn asn1_decode<'a>( /// input must be a valid buffer of at least input_len bytes /// pointer must be freed using `rs_asn1_free` #[no_mangle] -pub unsafe extern "C" fn rs_asn1_decode( +pub unsafe extern fn rs_asn1_decode( input: *const u8, input_len: u32, buffer_offset: u32, ad_ptr: *const DetectAsn1Data, ) -> *mut Asn1<'static> { if input.is_null() || input_len == 0 || ad_ptr.is_null() { @@ -226,7 +224,7 @@ pub unsafe extern "C" fn rs_asn1_decode( let slice = build_slice!(input, input_len as usize); - let ad = &*ad_ptr ; + let ad = &*ad_ptr; let res = asn1_decode(slice, buffer_offset, ad); @@ -242,7 +240,7 @@ pub unsafe extern "C" fn rs_asn1_decode( /// /// ptr must be a valid object obtained using `rs_asn1_decode` #[no_mangle] -pub unsafe extern "C" fn rs_asn1_free(ptr: *mut Asn1) { +pub unsafe extern fn rs_asn1_free(ptr: *mut Asn1) { if ptr.is_null() { return; } @@ -261,7 +259,7 @@ pub unsafe extern "C" fn rs_asn1_free(ptr: *mut Asn1) { /// /// Returns 1 if any of the options match, 0 if not #[no_mangle] -pub unsafe extern "C" fn rs_asn1_checks(ptr: *const Asn1, ad_ptr: *const DetectAsn1Data) -> u8 { +pub unsafe extern fn rs_asn1_checks(ptr: *const Asn1, ad_ptr: *const DetectAsn1Data) -> u8 { if ptr.is_null() || ad_ptr.is_null() { return 0; } diff --git a/rust/src/asn1/parse_rules.rs b/rust/src/asn1/parse_rules.rs index 540734c72fa5..8b2d568ddb46 100644 --- a/rust/src/asn1/parse_rules.rs +++ b/rust/src/asn1/parse_rules.rs @@ -34,7 +34,7 @@ const ASN1_DEFAULT_MAX_FRAMES: u16 = 30; /// /// pointer must be free'd using `rs_detect_asn1_free` #[no_mangle] -pub unsafe extern "C" fn rs_detect_asn1_parse(input: *const c_char) -> *mut DetectAsn1Data { +pub unsafe extern fn rs_detect_asn1_parse(input: *const c_char) -> *mut DetectAsn1Data { if input.is_null() { return std::ptr::null_mut(); } @@ -75,7 +75,7 @@ pub unsafe extern "C" fn rs_detect_asn1_parse(input: *const c_char) -> *mut Dete /// /// ptr must be a valid object obtained using `rs_detect_asn1_parse` #[no_mangle] -pub unsafe extern "C" fn rs_detect_asn1_free(ptr: *mut DetectAsn1Data) { +pub unsafe extern fn rs_detect_asn1_free(ptr: *mut DetectAsn1Data) { if ptr.is_null() { return; } @@ -125,10 +125,7 @@ fn parse_i32_number(input: &str) -> IResult<&str, i32> { pub(super) fn asn1_parse_rule(input: &str) -> IResult<&str, DetectAsn1Data> { // If nothing to parse, return if input.is_empty() { - return Err(Err::Error(make_error( - input, - ErrorKind::Eof, - ))); + return Err(Err::Error(make_error(input, ErrorKind::Eof))); } // Rule parsing functions @@ -196,10 +193,7 @@ pub(super) fn asn1_parse_rule(input: &str) -> IResult<&str, DetectAsn1Data> { } else if let Some((_, v)) = relative_offset { data.relative_offset = Some(v); } else { - return Err(Err::Error(make_error( - rest, - ErrorKind::Verify, - ))); + return Err(Err::Error(make_error(rest, ErrorKind::Verify))); } rest = new_rest; diff --git a/rust/src/bittorrent_dht/bittorrent_dht.rs b/rust/src/bittorrent_dht/bittorrent_dht.rs index 8c6857dc5d92..d02b6cacf602 100644 --- a/rust/src/bittorrent_dht/bittorrent_dht.rs +++ b/rust/src/bittorrent_dht/bittorrent_dht.rs @@ -19,7 +19,7 @@ use crate::applayer::{self, *}; use crate::bittorrent_dht::parser::{ parse_bittorrent_dht_packet, BitTorrentDHTError, BitTorrentDHTRequest, BitTorrentDHTResponse, }; -use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_UDP, Direction}; +use crate::core::{AppProto, Direction, Flow, ALPROTO_UNKNOWN, IPPROTO_UDP}; use std::ffi::CString; use std::os::raw::c_char; @@ -47,10 +47,10 @@ pub struct BitTorrentDHTTransaction { impl BitTorrentDHTTransaction { pub fn new(direction: Direction) -> Self { - Self { - tx_data: AppLayerTxData::for_direction(direction), - ..Default::default() - } + Self { + tx_data: AppLayerTxData::for_direction(direction), + ..Default::default() + } } /// Set an event on the transaction @@ -142,7 +142,7 @@ export_tx_data_get!(rs_bittorrent_dht_get_tx_data, BitTorrentDHTTransaction); export_state_data_get!(rs_bittorrent_dht_get_state_data, BitTorrentDHTState); #[no_mangle] -pub extern "C" fn rs_bittorrent_dht_state_new( +pub extern fn rs_bittorrent_dht_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = BitTorrentDHTState::new(); @@ -151,40 +151,48 @@ pub extern "C" fn rs_bittorrent_dht_state_new( } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_state_free(state: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_bittorrent_dht_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(Box::from_raw(state as *mut BitTorrentDHTState)); } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_state_tx_free( - state: *mut std::os::raw::c_void, tx_id: u64, -) { +pub unsafe extern fn rs_bittorrent_dht_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, BitTorrentDHTState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_parse_ts( +pub unsafe extern fn rs_bittorrent_dht_parse_ts( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { return rs_bittorrent_dht_parse( - _flow, state, _pstate, stream_slice, - _data, crate::core::Direction::ToServer); + _flow, + state, + _pstate, + stream_slice, + _data, + crate::core::Direction::ToServer, + ); } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_parse_tc( +pub unsafe extern fn rs_bittorrent_dht_parse_tc( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { return rs_bittorrent_dht_parse( - _flow, state, _pstate, stream_slice, - _data, crate::core::Direction::ToClient); + _flow, + state, + _pstate, + stream_slice, + _data, + crate::core::Direction::ToClient, + ); } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_parse( +pub unsafe extern fn rs_bittorrent_dht_parse( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, direction: crate::core::Direction, @@ -195,7 +203,7 @@ pub unsafe extern "C" fn rs_bittorrent_dht_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_state_get_tx( +pub unsafe extern fn rs_bittorrent_dht_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, BitTorrentDHTState); @@ -210,15 +218,13 @@ pub unsafe extern "C" fn rs_bittorrent_dht_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_state_get_tx_count( - state: *mut std::os::raw::c_void, -) -> u64 { +pub unsafe extern fn rs_bittorrent_dht_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, BitTorrentDHTState); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_tx_get_alstate_progress( +pub unsafe extern fn rs_bittorrent_dht_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, BitTorrentDHTTransaction); @@ -232,7 +238,7 @@ pub unsafe extern "C" fn rs_bittorrent_dht_tx_get_alstate_progress( } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_state_get_tx_iterator( +pub unsafe extern fn rs_bittorrent_dht_state_get_tx_iterator( _ipproto: u8, _alproto: AppProto, state: *mut std::os::raw::c_void, min_tx_id: u64, _max_tx_id: u64, istate: &mut u64, ) -> applayer::AppLayerGetTxIterTuple { @@ -253,7 +259,7 @@ pub unsafe extern "C" fn rs_bittorrent_dht_state_get_tx_iterator( const PARSER_NAME: &[u8] = b"bittorrent-dht\0"; #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_udp_register_parser() { +pub unsafe extern fn rs_bittorrent_dht_udp_register_parser() { let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, default_port: std::ptr::null(), diff --git a/rust/src/bittorrent_dht/logger.rs b/rust/src/bittorrent_dht/logger.rs index 74ea7c59ba57..42afac6effc8 100644 --- a/rust/src/bittorrent_dht/logger.rs +++ b/rust/src/bittorrent_dht/logger.rs @@ -131,7 +131,7 @@ fn log_bittorrent_dht( } #[no_mangle] -pub unsafe extern "C" fn rs_bittorrent_dht_logger_log( +pub unsafe extern fn rs_bittorrent_dht_logger_log( tx: *mut std::os::raw::c_void, js: &mut JsonBuilder, ) -> bool { let tx = cast_pointer!(tx, BitTorrentDHTTransaction); diff --git a/rust/src/common.rs b/rust/src/common.rs index c874cc58b87d..88b30ba9e495 100644 --- a/rust/src/common.rs +++ b/rust/src/common.rs @@ -114,7 +114,7 @@ pub fn rust_string_to_c(s: String) -> *mut c_char { /// /// s must be allocated by rust, using `CString::new` #[no_mangle] -pub unsafe extern "C" fn rs_cstring_free(s: *mut c_char) { +pub unsafe extern fn rs_cstring_free(s: *mut c_char) { if s.is_null() { return; } @@ -135,9 +135,7 @@ pub fn to_hex(input: &[u8]) -> String { } #[no_mangle] -pub unsafe extern "C" fn rs_to_hex( - output: *mut u8, out_len: usize, input: *const u8, in_len: usize, -) { +pub unsafe extern fn rs_to_hex(output: *mut u8, out_len: usize, input: *const u8, in_len: usize) { if out_len < 2 * in_len + 1 { return; } @@ -152,7 +150,7 @@ pub unsafe extern "C" fn rs_to_hex( } #[no_mangle] -pub unsafe extern "C" fn rs_to_hex_sep( +pub unsafe extern fn rs_to_hex_sep( output: *mut u8, out_len: usize, sep: u8, input: *const u8, in_len: usize, ) { if out_len < 3 * in_len { diff --git a/rust/src/conf.rs b/rust/src/conf.rs index 50acf6cae895..110e7e6a5ebc 100644 --- a/rust/src/conf.rs +++ b/rust/src/conf.rs @@ -17,26 +17,24 @@ //! Module for retrieving configuration details. -use std::os::raw::c_char; -use std::os::raw::c_void; -use std::os::raw::c_int; -use std::ffi::{CString, CStr}; -use std::ptr; -use std::str; use nom7::{ character::complete::{multispace0, not_line_ending}, - sequence::{preceded, tuple}, - number::complete::double, combinator::verify, + number::complete::double, + sequence::{preceded, tuple}, IResult, }; +use std::ffi::{CStr, CString}; +use std::os::raw::c_char; +use std::os::raw::c_int; +use std::os::raw::c_void; +use std::ptr; +use std::str; extern { fn ConfGet(key: *const c_char, res: *mut *const c_char) -> i8; - fn ConfGetChildValue(conf: *const c_void, key: *const c_char, - vptr: *mut *const c_char) -> i8; - fn ConfGetChildValueBool(conf: *const c_void, key: *const c_char, - vptr: *mut c_int) -> i8; + fn ConfGetChildValue(conf: *const c_void, key: *const c_char, vptr: *mut *const c_char) -> i8; + fn ConfGetChildValueBool(conf: *const c_void, key: *const c_char, vptr: *mut c_int) -> i8; fn ConfGetNode(key: *const c_char) -> *const c_void; } @@ -71,9 +69,7 @@ pub fn conf_get(key: &str) -> Option<&str> { return None; } - let value = str::from_utf8(unsafe{ - CStr::from_ptr(vptr).to_bytes() - }).unwrap(); + let value = str::from_utf8(unsafe { CStr::from_ptr(vptr).to_bytes() }).unwrap(); return Some(value); } @@ -85,8 +81,8 @@ pub fn conf_get_bool(key: &str) -> bool { match val { "1" | "yes" | "true" | "on" => { return true; - }, - _ => {}, + } + _ => {} } } @@ -100,9 +96,8 @@ pub struct ConfNode { } impl ConfNode { - pub fn wrap(conf: *const c_void) -> Self { - return Self { conf } + return Self { conf }; } pub fn get_child_value(&self, key: &str) -> Option<&str> { @@ -110,9 +105,7 @@ impl ConfNode { unsafe { let s = CString::new(key).unwrap(); - if ConfGetChildValue(self.conf, - s.as_ptr(), - &mut vptr) != 1 { + if ConfGetChildValue(self.conf, s.as_ptr(), &mut vptr) != 1 { return None; } } @@ -121,9 +114,7 @@ impl ConfNode { return None; } - let value = str::from_utf8(unsafe{ - CStr::from_ptr(vptr).to_bytes() - }).unwrap(); + let value = str::from_utf8(unsafe { CStr::from_ptr(vptr).to_bytes() }).unwrap(); return Some(value); } @@ -133,9 +124,7 @@ impl ConfNode { unsafe { let s = CString::new(key).unwrap(); - if ConfGetChildValueBool(self.conf, - s.as_ptr(), - &mut vptr) != 1 { + if ConfGetChildValueBool(self.conf, s.as_ptr(), &mut vptr) != 1 { return false; } } @@ -145,13 +134,12 @@ impl ConfNode { } return false; } - } -const BYTE: u64 = 1; -const KILOBYTE: u64 = 1024; -const MEGABYTE: u64 = 1_048_576; -const GIGABYTE: u64 = 1_073_741_824; +const BYTE: u64 = 1; +const KILOBYTE: u64 = 1024; +const MEGABYTE: u64 = 1_048_576; +const GIGABYTE: u64 = 1_073_741_824; /// Helper function to retrieve memory unit from a string slice /// @@ -163,11 +151,11 @@ const GIGABYTE: u64 = 1_073_741_824; fn get_memunit(unit: &str) -> u64 { let unit = &unit.to_lowercase()[..]; match unit { - "b" => { BYTE } - "kb" => { KILOBYTE } - "mb" => { MEGABYTE } - "gb" => { GIGABYTE } - _ => { 0 } + "b" => BYTE, + "kb" => KILOBYTE, + "mb" => MEGABYTE, + "gb" => GIGABYTE, + _ => 0, } } @@ -184,8 +172,10 @@ pub fn get_memval(arg: &str) -> Result { let arg = arg.trim(); let val: f64; let mut unit: &str; - let mut parser = tuple((preceded(multispace0, double), - preceded(multispace0, verify(not_line_ending, |c: &str| c.len() < 3)))); + let mut parser = tuple(( + preceded(multispace0, double), + preceded(multispace0, verify(not_line_ending, |c: &str| c.len() < 3)), + )); let r: IResult<&str, (f64, &str)> = parser(arg); if let Ok(r) = r { val = (r.1).0; @@ -211,7 +201,7 @@ mod tests { #[test] fn test_memval_nospace() { let s = "10"; - let res = 10 ; + let res = 10; assert_eq!(Ok(10), get_memval(s)); let s = "10kb"; @@ -233,7 +223,7 @@ mod tests { #[test] fn test_memval_space_start() { let s = " 10"; - let res = 10 ; + let res = 10; assert_eq!(Ok(res), get_memval(s)); let s = " 10Kb"; @@ -252,7 +242,7 @@ mod tests { #[test] fn test_memval_space_end() { let s = " 10 "; - let res = 10 ; + let res = 10; assert_eq!(Ok(res), get_memval(s)); let s = "10Kb "; @@ -271,7 +261,7 @@ mod tests { #[test] fn test_memval_space_in_bw() { let s = " 10 "; - let res = 10 ; + let res = 10; assert_eq!(Ok(res), get_memval(s)); let s = "10 Kb "; diff --git a/rust/src/core.rs b/rust/src/core.rs index abb27ea578fe..27cd6dc46aed 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -17,9 +17,9 @@ //! This module exposes items from the core "C" code to Rust. -use std; -use crate::filecontainer::*; use crate::debug_validate_fail; +use crate::filecontainer::*; +use std; /// Opaque C types. pub enum DetectEngineState {} @@ -33,16 +33,16 @@ pub enum AppLayerEventType { APP_LAYER_EVENT_TYPE_PACKET = 2, } -pub const STREAM_START: u8 = 0x01; -pub const STREAM_EOF: u8 = 0x02; +pub const STREAM_START: u8 = 0x01; +pub const STREAM_EOF: u8 = 0x02; pub const STREAM_TOSERVER: u8 = 0x04; pub const STREAM_TOCLIENT: u8 = 0x08; -pub const STREAM_GAP: u8 = 0x10; -pub const STREAM_DEPTH: u8 = 0x20; -pub const STREAM_MIDSTREAM:u8 = 0x40; -pub const DIR_BOTH: u8 = 0b0000_1100; -const DIR_TOSERVER: u8 = 0b0000_0100; -const DIR_TOCLIENT: u8 = 0b0000_1000; +pub const STREAM_GAP: u8 = 0x10; +pub const STREAM_DEPTH: u8 = 0x20; +pub const STREAM_MIDSTREAM: u8 = 0x40; +pub const DIR_BOTH: u8 = 0b0000_1100; +const DIR_TOSERVER: u8 = 0b0000_0100; +const DIR_TOCLIENT: u8 = 0b0000_1000; #[repr(C)] #[derive(Debug, PartialEq, Eq, Clone, Copy)] @@ -54,17 +54,19 @@ pub enum Direction { impl Direction { /// Return true if the direction is to server. pub fn is_to_server(&self) -> bool { - matches!(self, Self::ToServer) + matches!(self, Self::ToServer) } /// Return true if the direction is to client. pub fn is_to_client(&self) -> bool { - matches!(self, Self::ToClient) + matches!(self, Self::ToClient) } } impl Default for Direction { - fn default() -> Self { Direction::ToServer } + fn default() -> Self { + Direction::ToServer + } } impl std::fmt::Display for Direction { @@ -101,27 +103,33 @@ impl From for u8 { // Application layer protocol identifiers (app-layer-protos.h) pub type AppProto = u16; -pub const ALPROTO_UNKNOWN : AppProto = 0; -pub static mut ALPROTO_FAILED : AppProto = 0; // updated during init +pub const ALPROTO_UNKNOWN: AppProto = 0; +pub static mut ALPROTO_FAILED: AppProto = 0; // updated during init -pub const IPPROTO_TCP : u8 = 6; -pub const IPPROTO_UDP : u8 = 17; +pub const IPPROTO_TCP: u8 = 6; +pub const IPPROTO_UDP: u8 = 17; /* macro_rules!BIT_U8 { ($x:expr) => (1 << $x); } */ -macro_rules!BIT_U16 { - ($x:expr) => (1 << $x); +macro_rules! BIT_U16 { + ($x:expr) => { + 1 << $x + }; } -macro_rules!BIT_U32 { - ($x:expr) => (1 << $x); +macro_rules! BIT_U32 { + ($x:expr) => { + 1 << $x + }; } -macro_rules!BIT_U64 { - ($x:expr) => (1 << $x); +macro_rules! BIT_U64 { + ($x:expr) => { + 1 << $x + }; } // Flow flags @@ -137,66 +145,72 @@ extern { // #[allow(non_snake_case)] -pub type SCLogMessageFunc = - extern "C" fn(level: std::os::raw::c_int, - filename: *const std::os::raw::c_char, - line: std::os::raw::c_uint, - function: *const std::os::raw::c_char, - subsystem: *const std::os::raw::c_char, - message: *const std::os::raw::c_char) -> std::os::raw::c_int; +pub type SCLogMessageFunc = extern fn( + level: std::os::raw::c_int, + filename: *const std::os::raw::c_char, + line: std::os::raw::c_uint, + function: *const std::os::raw::c_char, + subsystem: *const std::os::raw::c_char, + message: *const std::os::raw::c_char, +) -> std::os::raw::c_int; -pub type DetectEngineStateFreeFunc = - extern "C" fn(state: *mut DetectEngineState); +pub type DetectEngineStateFreeFunc = extern fn(state: *mut DetectEngineState); pub type AppLayerParserTriggerRawStreamReassemblyFunc = - extern "C" fn (flow: *const Flow, direction: i32); + extern fn(flow: *const Flow, direction: i32); pub type AppLayerDecoderEventsSetEventRawFunc = - extern "C" fn (events: *mut *mut AppLayerDecoderEvents, - event: u8); + extern fn(events: *mut *mut AppLayerDecoderEvents, event: u8); -pub type AppLayerDecoderEventsFreeEventsFunc = - extern "C" fn (events: *mut *mut AppLayerDecoderEvents); +pub type AppLayerDecoderEventsFreeEventsFunc = extern fn(events: *mut *mut AppLayerDecoderEvents); pub enum StreamingBufferConfig {} // Opaque flow type (defined in C) pub enum HttpRangeContainerBlock {} -pub type SCHttpRangeFreeBlock = extern "C" fn ( - c: *mut HttpRangeContainerBlock); -pub type SCHTPFileCloseHandleRange = extern "C" fn ( - sbcfg: &StreamingBufferConfig, - fc: *mut FileContainer, - flags: u16, - c: *mut HttpRangeContainerBlock, - data: *const u8, - data_len: u32) -> bool; -pub type SCFileOpenFileWithId = extern "C" fn ( - file_container: &FileContainer, - sbcfg: &StreamingBufferConfig, - track_id: u32, - name: *const u8, name_len: u16, - data: *const u8, data_len: u32, - flags: u16) -> i32; -pub type SCFileCloseFileById = extern "C" fn ( - file_container: &FileContainer, - sbcfg: &StreamingBufferConfig, - track_id: u32, - data: *const u8, data_len: u32, - flags: u16) -> i32; -pub type SCFileAppendDataById = extern "C" fn ( - file_container: &FileContainer, - sbcfg: &StreamingBufferConfig, - track_id: u32, - data: *const u8, data_len: u32) -> i32; -pub type SCFileAppendGAPById = extern "C" fn ( - file_container: &FileContainer, - sbcfg: &StreamingBufferConfig, - track_id: u32, - data: *const u8, data_len: u32) -> i32; -pub type SCFileContainerRecycle = extern "C" fn ( - file_container: &FileContainer, - sbcfg: &StreamingBufferConfig); +pub type SCHttpRangeFreeBlock = extern fn(c: *mut HttpRangeContainerBlock); +pub type SCHTPFileCloseHandleRange = extern fn( + sbcfg: &StreamingBufferConfig, + fc: *mut FileContainer, + flags: u16, + c: *mut HttpRangeContainerBlock, + data: *const u8, + data_len: u32, +) -> bool; +pub type SCFileOpenFileWithId = extern fn( + file_container: &FileContainer, + sbcfg: &StreamingBufferConfig, + track_id: u32, + name: *const u8, + name_len: u16, + data: *const u8, + data_len: u32, + flags: u16, +) -> i32; +pub type SCFileCloseFileById = extern fn( + file_container: &FileContainer, + sbcfg: &StreamingBufferConfig, + track_id: u32, + data: *const u8, + data_len: u32, + flags: u16, +) -> i32; +pub type SCFileAppendDataById = extern fn( + file_container: &FileContainer, + sbcfg: &StreamingBufferConfig, + track_id: u32, + data: *const u8, + data_len: u32, +) -> i32; +pub type SCFileAppendGAPById = extern fn( + file_container: &FileContainer, + sbcfg: &StreamingBufferConfig, + track_id: u32, + data: *const u8, + data_len: u32, +) -> i32; +pub type SCFileContainerRecycle = + extern fn(file_container: &FileContainer, sbcfg: &StreamingBufferConfig); // A Suricata context that is passed in from C. This is alternative to // using functions from Suricata directly, so they can be wrapped so @@ -223,7 +237,10 @@ pub struct SuricataContext { pub FileAppendGAP: SCFileAppendGAPById, pub FileContainerRecycle: SCFileContainerRecycle, - pub AppLayerRegisterParser: extern fn(parser: *const crate::applayer::RustParser, alproto: AppProto) -> std::os::raw::c_int, + pub AppLayerRegisterParser: extern fn( + parser: *const crate::applayer::RustParser, + alproto: AppProto, + ) -> std::os::raw::c_int, } #[allow(non_snake_case)] @@ -239,8 +256,7 @@ extern { pub static mut SC: Option<&'static SuricataContext> = None; -pub fn init_ffi(context: &'static SuricataContext) -{ +pub fn init_ffi(context: &'static SuricataContext) { unsafe { SC = Some(context); ALPROTO_FAILED = StringToAppProto("failed\0".as_ptr()); @@ -248,14 +264,12 @@ pub fn init_ffi(context: &'static SuricataContext) } #[no_mangle] -pub extern "C" fn rs_init(context: &'static SuricataContext) -{ +pub extern fn rs_init(context: &'static SuricataContext) { init_ffi(context); } /// DetectEngineStateFree wrapper. -pub fn sc_detect_engine_state_free(state: *mut DetectEngineState) -{ +pub fn sc_detect_engine_state_free(state: *mut DetectEngineState) { unsafe { if let Some(c) = SC { (c.DetectEngineStateFree)(state); @@ -274,8 +288,8 @@ pub fn sc_app_layer_parser_trigger_raw_stream_reassembly(flow: *const Flow, dire /// AppLayerDecoderEventsSetEventRaw wrapper. pub fn sc_app_layer_decoder_events_set_event_raw( - events: *mut *mut AppLayerDecoderEvents, event: u8) -{ + events: *mut *mut AppLayerDecoderEvents, event: u8, +) { unsafe { if let Some(c) = SC { (c.AppLayerDecoderEventsSetEventRaw)(events, event); @@ -284,9 +298,7 @@ pub fn sc_app_layer_decoder_events_set_event_raw( } /// AppLayerDecoderEventsFreeEvents wrapper. -pub fn sc_app_layer_decoder_events_free_events( - events: *mut *mut AppLayerDecoderEvents) -{ +pub fn sc_app_layer_decoder_events_free_events(events: *mut *mut AppLayerDecoderEvents) { unsafe { if let Some(c) = SC { (c.AppLayerDecoderEventsFreeEvents)(events); @@ -307,7 +319,6 @@ extern { /// Rust implementation of Flow. impl Flow { - /// Return the time of the last flow update as a `Duration` /// since the epoch. pub fn get_last_time(&mut self) -> std::time::Duration { @@ -336,10 +347,10 @@ mod test { #[test] fn test_direction() { - assert!(Direction::ToServer.is_to_server()); - assert!(!Direction::ToServer.is_to_client()); + assert!(Direction::ToServer.is_to_server()); + assert!(!Direction::ToServer.is_to_client()); - assert!(Direction::ToClient.is_to_client()); - assert!(!Direction::ToClient.is_to_server()); + assert!(Direction::ToClient.is_to_client()); + assert!(!Direction::ToClient.is_to_server()); } } diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index 759d5c26343a..61b612b08f75 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -16,6 +16,7 @@ */ use crate::applayer::{self, *}; +use crate::conf::conf_get; use crate::core::{self, *}; use crate::dcerpc::parser; use nom7::error::{Error, ErrorKind}; @@ -23,9 +24,8 @@ use nom7::number::Endianness; use nom7::{Err, IResult, Needed}; use std; use std::cmp; -use std::ffi::CString; use std::collections::VecDeque; -use crate::conf::conf_get; +use std::ffi::CString; // Constant DCERPC UDP Header length pub const DCERPC_HDR_LEN: u16 = 16; @@ -206,7 +206,7 @@ impl DCERPCTransaction { activityuuid: Vec::new(), tx_data: AppLayerTxData::new(), ..Default::default() - } + }; } pub fn get_req_ctxid(&self) -> u16 { @@ -322,7 +322,8 @@ pub struct DCERPCState { pub tc_gap: bool, pub ts_ssn_gap: bool, pub tc_ssn_gap: bool, - pub ts_ssn_trunc: bool, /// true if Truncated in this direction + pub ts_ssn_trunc: bool, + /// true if Truncated in this direction pub tc_ssn_trunc: bool, pub flow: Option<*const core::Flow>, state_data: AppLayerStateData, @@ -344,7 +345,7 @@ impl DCERPCState { data_needed_for_dir: Direction::ToServer, prev_dir: Direction::ToServer, ..Default::default() - } + }; } fn create_tx(&mut self, call_id: u32) -> DCERPCTransaction { @@ -372,13 +373,14 @@ impl DCERPCState { } pub fn free_tx(&mut self, tx_id: u64) { - SCLogDebug!("Freeing TX with ID {} TX.ID {}", tx_id, tx_id+1); + SCLogDebug!("Freeing TX with ID {} TX.ID {}", tx_id, tx_id + 1); let len = self.transactions.len(); let mut found = false; let mut index = 0; for i in 0..len { let tx = &self.transactions[i]; - if tx.id == tx_id { //+ 1 { + if tx.id == tx_id { + //+ 1 { found = true; index = i; SCLogDebug!("tx {} progress {}/{}", tx.id, tx.req_done, tx.resp_done); @@ -386,8 +388,14 @@ impl DCERPCState { } } if found { - SCLogDebug!("freeing TX with ID {} TX.ID {} at index {} left: {} max id: {}", - tx_id, tx_id+1, index, self.transactions.len(), self.tx_id); + SCLogDebug!( + "freeing TX with ID {} TX.ID {} at index {} left: {} max id: {}", + tx_id, + tx_id + 1, + index, + self.transactions.len(), + self.tx_id + ); self.tx_index_completed = 0; self.transactions.remove(index); } @@ -512,7 +520,9 @@ impl DCERPCState { /// /// Return value: /// Option mutable reference to DCERPCTransaction - pub fn get_tx_by_call_id(&mut self, call_id: u32, dir: Direction) -> Option<&mut DCERPCTransaction> { + pub fn get_tx_by_call_id( + &mut self, call_id: u32, dir: Direction, + ) -> Option<&mut DCERPCTransaction> { let cmd = self.get_hdr_type().unwrap_or(0); for tx in &mut self.transactions { let found = tx.call_id == call_id; @@ -542,17 +552,22 @@ impl DCERPCState { Direction::ToServer => { self.ts_gap = true; self.ts_ssn_gap = true; - }, + } Direction::ToClient => { self.tc_gap = true; self.tc_ssn_gap = true; - }, + } } AppLayerResult::ok() } pub fn post_gap_housekeeping(&mut self, dir: Direction) { - SCLogDebug!("ts ssn gap: {:?}, tc ssn gap: {:?}, dir: {:?}", self.ts_ssn_gap, self.tc_ssn_gap, dir); + SCLogDebug!( + "ts ssn gap: {:?}, tc ssn gap: {:?}, dir: {:?}", + self.ts_ssn_gap, + self.tc_ssn_gap, + dir + ); if self.ts_ssn_gap && dir == Direction::ToServer { for tx in &mut self.transactions { if tx.id >= self.tx_id { @@ -588,7 +603,7 @@ impl DCERPCState { } } - pub fn search_dcerpc_record<'a>(&mut self, i: &'a[u8]) -> IResult<&'a[u8], &'a[u8]> { + pub fn search_dcerpc_record<'a>(&mut self, i: &'a [u8]) -> IResult<&'a [u8], &'a [u8]> { let mut d = i; while d.len() >= 2 { if d[0] == 0x05 && d[1] == 0x00 { @@ -631,7 +646,10 @@ impl DCERPCState { SCLogDebug!("Insufficient data while parsing DCERPC header"); -1 } - Err(Err::Error(Error{code:ErrorKind::Eof, ..})) => { + Err(Err::Error(Error { + code: ErrorKind::Eof, + .. + })) => { SCLogDebug!("EoF reached while parsing DCERPC header"); -1 } @@ -697,7 +715,10 @@ impl DCERPCState { tx.req_cmd = self.get_hdr_type().unwrap_or(0); tx.req_done = true; if let Some(flow) = self.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToServer as i32); + sc_app_layer_parser_trigger_raw_stream_reassembly( + flow, + Direction::ToServer as i32, + ); } tx.frag_cnt_ts = 1; self.transactions.push_back(tx); @@ -780,7 +801,10 @@ impl DCERPCState { tx.req_done = true; tx.frag_cnt_ts = 1; if let Some(flow) = self.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToServer as i32); + sc_app_layer_parser_trigger_raw_stream_reassembly( + flow, + Direction::ToServer as i32, + ); } } DCERPC_TYPE_RESPONSE => { @@ -795,7 +819,10 @@ impl DCERPCState { tx.resp_done = true; tx.frag_cnt_tc = 1; if let Some(flow) = self.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToClient as i32); + sc_app_layer_parser_trigger_raw_stream_reassembly( + flow, + Direction::ToClient as i32, + ); } } _ => { @@ -829,7 +856,9 @@ impl DCERPCState { /// Return value: /// * Success: Number of bytes successfully parsed. /// * Failure: -1 in case fragment length defined by header mismatches the data. - pub fn handle_common_stub(&mut self, input: &[u8], bytes_consumed: usize, dir: Direction) -> i32 { + pub fn handle_common_stub( + &mut self, input: &[u8], bytes_consumed: usize, dir: Direction, + ) -> i32 { let fraglen = self.get_hdr_fraglen().unwrap_or(0); if (fraglen as usize) < bytes_consumed + (DCERPC_HDR_LEN as usize) { return -1; @@ -912,7 +941,9 @@ impl DCERPCState { self.query_completed = false; // Skip the record since this means that its in the middle of a known length record - if (self.ts_gap && direction == Direction::ToServer) || (self.tc_gap && direction == Direction::ToClient) { + if (self.ts_gap && direction == Direction::ToServer) + || (self.tc_gap && direction == Direction::ToClient) + { SCLogDebug!("Trying to catch up after GAP (input {})", cur_i.len()); match self.search_dcerpc_record(cur_i) { Ok((_, pg)) => { @@ -922,12 +953,12 @@ impl DCERPCState { match direction { Direction::ToServer => { self.ts_gap = false; - }, + } Direction::ToClient => { self.tc_gap = false; } } - }, + } _ => { let mut consumed = cur_i.len(); // At least 2 bytes are required to know if a new record is beginning @@ -938,7 +969,7 @@ impl DCERPCState { } SCLogDebug!("DCERPC record NOT found"); return AppLayerResult::incomplete(consumed as u32, 2); - }, + } } } @@ -1016,7 +1047,9 @@ impl DCERPCState { if retval == -1 { return AppLayerResult::err(); } - let tx = if let Some(tx) = self.get_tx_by_call_id(current_call_id, Direction::ToClient) { + let tx = if let Some(tx) = + self.get_tx_by_call_id(current_call_id, Direction::ToClient) + { tx.resp_cmd = x; tx } else { @@ -1028,7 +1061,10 @@ impl DCERPCState { tx.resp_done = true; tx.frag_cnt_tc = 1; if let Some(flow) = self.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToClient as i32); + sc_app_layer_parser_trigger_raw_stream_reassembly( + flow, + Direction::ToClient as i32, + ); } } DCERPC_TYPE_REQUEST => { @@ -1051,11 +1087,8 @@ impl DCERPCState { self.transactions.push_back(tx); } }; - retval = self.handle_common_stub( - &buffer[parsed as usize..], - 0, - Direction::ToClient, - ); + retval = + self.handle_common_stub(&buffer[parsed as usize..], 0, Direction::ToClient); if retval < 0 { return AppLayerResult::err(); } @@ -1084,10 +1117,9 @@ impl DCERPCState { } fn evaluate_stub_params( - input: &[u8], input_len: usize, hdrflags: u8, lenleft: u16, - stub_data_buffer: &mut Vec,stub_data_buffer_reset: &mut bool, + input: &[u8], input_len: usize, hdrflags: u8, lenleft: u16, stub_data_buffer: &mut Vec, + stub_data_buffer_reset: &mut bool, ) -> u16 { - let fragtype = hdrflags & (PFC_FIRST_FRAG | PFC_LAST_FRAG); // min of usize and u16 is a valid u16 let stub_len: u16 = cmp::min(lenleft as usize, input_len) as u16; @@ -1105,37 +1137,40 @@ fn evaluate_stub_params( } #[no_mangle] -pub extern "C" fn rs_parse_dcerpc_request_gap( - state: &mut DCERPCState, - _input_len: u32, +pub extern fn rs_parse_dcerpc_request_gap( + state: &mut DCERPCState, _input_len: u32, ) -> AppLayerResult { state.parse_data_gap(Direction::ToServer) } #[no_mangle] -pub extern "C" fn rs_parse_dcerpc_response_gap( - state: &mut DCERPCState, - _input_len: u32, +pub extern fn rs_parse_dcerpc_response_gap( + state: &mut DCERPCState, _input_len: u32, ) -> AppLayerResult { state.parse_data_gap(Direction::ToClient) } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_parse_request( +pub unsafe extern fn rs_dcerpc_parse_request( flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, DCERPCState); let flags = stream_slice.flags(); - SCLogDebug!("Handling request: input_len {} flags {:x} EOF {}", - stream_slice.len(), flags, flags & core::STREAM_EOF != 0); + SCLogDebug!( + "Handling request: input_len {} flags {:x} EOF {}", + stream_slice.len(), + flags, + flags & core::STREAM_EOF != 0 + ); if flags & core::STREAM_EOF != 0 && stream_slice.is_empty() { return AppLayerResult::ok(); } /* START with MIDSTREAM set: record might be starting the middle. */ - if flags & (core::STREAM_START|core::STREAM_MIDSTREAM) == (core::STREAM_START|core::STREAM_MIDSTREAM) { + if flags & (core::STREAM_START | core::STREAM_MIDSTREAM) + == (core::STREAM_START | core::STREAM_MIDSTREAM) + { state.ts_gap = true; } if !stream_slice.is_gap() { @@ -1146,10 +1181,9 @@ pub unsafe extern "C" fn rs_dcerpc_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_parse_response( +pub unsafe extern fn rs_dcerpc_parse_response( flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, DCERPCState); let flags = stream_slice.flags(); @@ -1158,7 +1192,9 @@ pub unsafe extern "C" fn rs_dcerpc_parse_response( return AppLayerResult::ok(); } /* START with MIDSTREAM set: record might be starting the middle. */ - if flags & (core::STREAM_START|core::STREAM_MIDSTREAM) == (core::STREAM_START|core::STREAM_MIDSTREAM) { + if flags & (core::STREAM_START | core::STREAM_MIDSTREAM) + == (core::STREAM_START | core::STREAM_MIDSTREAM) + { state.tc_gap = true; } if !stream_slice.is_gap() { @@ -1169,53 +1205,69 @@ pub unsafe extern "C" fn rs_dcerpc_parse_response( } #[no_mangle] -pub extern "C" fn rs_dcerpc_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_dcerpc_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto, +) -> *mut std::os::raw::c_void { let state = DCERPCState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub extern "C" fn rs_dcerpc_state_free(state: *mut std::os::raw::c_void) { - std::mem::drop(unsafe { Box::from_raw(state as *mut DCERPCState)} ); +pub extern fn rs_dcerpc_state_free(state: *mut std::os::raw::c_void) { + std::mem::drop(unsafe { Box::from_raw(state as *mut DCERPCState) }); } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_state_transaction_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_dcerpc_state_transaction_free( + state: *mut std::os::raw::c_void, tx_id: u64, +) { let dce_state = cast_pointer!(state, DCERPCState); SCLogDebug!("freeing tx {}", tx_id); dce_state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_state_trunc(state: *mut std::os::raw::c_void, direction: u8) { +pub unsafe extern fn rs_dcerpc_state_trunc(state: *mut std::os::raw::c_void, direction: u8) { let dce_state = cast_pointer!(state, DCERPCState); match direction.into() { - Direction::ToServer => { + Direction::ToServer => { dce_state.ts_ssn_trunc = true; for tx in &mut dce_state.transactions { tx.req_done = true; if let Some(flow) = dce_state.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToServer as i32); + sc_app_layer_parser_trigger_raw_stream_reassembly( + flow, + Direction::ToServer as i32, + ); } } - SCLogDebug!("dce_state.ts_ssn_trunc = true; txs {}", dce_state.transactions.len()); + SCLogDebug!( + "dce_state.ts_ssn_trunc = true; txs {}", + dce_state.transactions.len() + ); } Direction::ToClient => { dce_state.tc_ssn_trunc = true; for tx in &mut dce_state.transactions { tx.resp_done = true; if let Some(flow) = dce_state.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToClient as i32); + sc_app_layer_parser_trigger_raw_stream_reassembly( + flow, + Direction::ToClient as i32, + ); } } - SCLogDebug!("dce_state.tc_ssn_trunc = true; txs {}", dce_state.transactions.len()); + SCLogDebug!( + "dce_state.tc_ssn_trunc = true; txs {}", + dce_state.transactions.len() + ); } } } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_get_tx( +pub unsafe extern fn rs_dcerpc_get_tx( vtx: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let dce_state = cast_pointer!(vtx, DCERPCState); @@ -1226,14 +1278,15 @@ pub unsafe extern "C" fn rs_dcerpc_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_get_tx_cnt(vtx: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_dcerpc_get_tx_cnt(vtx: *mut std::os::raw::c_void) -> u64 { let dce_state = cast_pointer!(vtx, DCERPCState); dce_state.tx_id } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_get_alstate_progress(tx: *mut std::os::raw::c_void, direction: u8 - )-> std::os::raw::c_int { +pub unsafe extern fn rs_dcerpc_get_alstate_progress( + tx: *mut std::os::raw::c_void, direction: u8, +) -> std::os::raw::c_int { let tx = cast_pointer!(tx, DCERPCTransaction); if direction == Direction::ToServer.into() && tx.req_done { SCLogDebug!("tx {} TOSERVER progress 1 => {:?}", tx.call_id, tx); @@ -1247,16 +1300,13 @@ pub unsafe extern "C" fn rs_dcerpc_get_alstate_progress(tx: *mut std::os::raw::c } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_get_tx_data( - tx: *mut std::os::raw::c_void) - -> *mut AppLayerTxData -{ +pub unsafe extern fn rs_dcerpc_get_tx_data(tx: *mut std::os::raw::c_void) -> *mut AppLayerTxData { let tx = cast_pointer!(tx, DCERPCTransaction); return &mut tx.tx_data; } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_get_stub_data( +pub unsafe extern fn rs_dcerpc_get_stub_data( tx: &mut DCERPCTransaction, buf: *mut *const u8, len: *mut u32, endianness: *mut u8, dir: u8, ) { match dir.into() { @@ -1279,26 +1329,26 @@ fn probe(input: &[u8]) -> (bool, bool) { match parser::parse_dcerpc_header(input) { Ok((_, hdr)) => { let is_request = hdr.hdrtype == 0x00 || hdr.hdrtype == 0x0e; - let is_dcerpc = hdr.rpc_vers == 0x05 && - hdr.rpc_vers_minor == 0x00 && - hdr.packed_drep[0] & 0xee == 0 && - hdr.packed_drep[1] <= 3; + let is_dcerpc = hdr.rpc_vers == 0x05 + && hdr.rpc_vers_minor == 0x00 + && hdr.packed_drep[0] & 0xee == 0 + && hdr.packed_drep[1] <= 3; return (is_dcerpc, is_request); - }, + } Err(_) => (false, false), } } -pub unsafe extern "C" fn rs_dcerpc_probe_tcp(_f: *const core::Flow, direction: u8, input: *const u8, - len: u32, rdir: *mut u8) -> AppProto -{ +pub unsafe extern fn rs_dcerpc_probe_tcp( + _f: *const core::Flow, direction: u8, input: *const u8, len: u32, rdir: *mut u8, +) -> AppProto { SCLogDebug!("Probing packet for DCERPC"); if len == 0 { return core::ALPROTO_UNKNOWN; } let slice: &[u8] = std::slice::from_raw_parts(input as *mut u8, len as usize); //is_incomplete is checked by caller - let (is_dcerpc, is_request, ) = probe(slice); + let (is_dcerpc, is_request) = probe(slice); if is_dcerpc { let dir = if is_request { Direction::ToServer @@ -1315,15 +1365,33 @@ pub unsafe extern "C" fn rs_dcerpc_probe_tcp(_f: *const core::Flow, direction: u fn register_pattern_probe() -> i8 { unsafe { - if AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_DCERPC, - b"|05 00|\0".as_ptr() as *const std::os::raw::c_char, 2, 0, - Direction::ToServer.into(), rs_dcerpc_probe_tcp, 0, 0) < 0 { + if AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_DCERPC, + b"|05 00|\0".as_ptr() as *const std::os::raw::c_char, + 2, + 0, + Direction::ToServer.into(), + rs_dcerpc_probe_tcp, + 0, + 0, + ) < 0 + { SCLogDebug!("TOSERVER => AppLayerProtoDetectPMRegisterPatternCSwPP FAILED"); return -1; } - if AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_DCERPC, - b"|05 00|\0".as_ptr() as *const std::os::raw::c_char, 2, 0, - Direction::ToClient.into(), rs_dcerpc_probe_tcp, 0, 0) < 0 { + if AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_DCERPC, + b"|05 00|\0".as_ptr() as *const std::os::raw::c_char, + 2, + 0, + Direction::ToClient.into(), + rs_dcerpc_probe_tcp, + 0, + 0, + ) < 0 + { SCLogDebug!("TOCLIENT => AppLayerProtoDetectPMRegisterPatternCSwPP FAILED"); return -1; } @@ -1338,7 +1406,7 @@ export_state_data_get!(rs_dcerpc_get_state_data, DCERPCState); pub const PARSER_NAME: &[u8] = b"dcerpc\0"; #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_register_parser() { +pub unsafe extern fn rs_dcerpc_register_parser() { let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, default_port: std::ptr::null(), @@ -1358,7 +1426,7 @@ pub unsafe extern "C" fn rs_dcerpc_register_parser() { tx_comp_st_tc: 1, tx_get_progress: rs_dcerpc_get_alstate_progress, get_eventinfo: None, - get_eventinfo_byid : None, + get_eventinfo_byid: None, localstorage_new: None, localstorage_free: None, get_tx_files: None, @@ -1374,21 +1442,13 @@ pub unsafe extern "C" fn rs_dcerpc_register_parser() { let ip_proto_str = CString::new("tcp").unwrap(); - if AppLayerProtoDetectConfProtoDetectionEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_DCERPC = alproto; if register_pattern_probe() < 0 { return; } - if AppLayerParserConfParserEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.dcerpc.max-tx") { diff --git a/rust/src/dcerpc/dcerpc_udp.rs b/rust/src/dcerpc/dcerpc_udp.rs index 83707bddcb21..9e0351a1cd58 100644 --- a/rust/src/dcerpc/dcerpc_udp.rs +++ b/rust/src/dcerpc/dcerpc_udp.rs @@ -18,14 +18,14 @@ use crate::applayer::{self, *}; use crate::core::{self, Direction, DIR_BOTH}; use crate::dcerpc::dcerpc::{ - DCERPCTransaction, DCERPC_MAX_TX, DCERPC_TYPE_REQUEST, DCERPC_TYPE_RESPONSE, PFCL1_FRAG, PFCL1_LASTFRAG, - rs_dcerpc_get_alstate_progress, ALPROTO_DCERPC, PARSER_NAME, + rs_dcerpc_get_alstate_progress, DCERPCTransaction, ALPROTO_DCERPC, DCERPC_MAX_TX, + DCERPC_TYPE_REQUEST, DCERPC_TYPE_RESPONSE, PARSER_NAME, PFCL1_FRAG, PFCL1_LASTFRAG, }; +use crate::dcerpc::parser; use nom7::Err; use std; -use std::ffi::CString; use std::collections::VecDeque; -use crate::dcerpc::parser; +use std::ffi::CString; // Constant DCERPC UDP Header length pub const DCERPC_UDP_HDR_LEN: i32 = 80; @@ -76,7 +76,7 @@ impl DCERPCUDPState { Default::default() } - fn create_tx(&mut self, hdr: &DCERPCHdrUdp) -> DCERPCTransaction { + fn create_tx(&mut self, hdr: &DCERPCHdrUdp) -> DCERPCTransaction { let mut tx = DCERPCTransaction::new(); tx.id = self.tx_id; tx.endianness = hdr.drep[0] & 0x10; @@ -99,13 +99,14 @@ impl DCERPCUDPState { } pub fn free_tx(&mut self, tx_id: u64) { - SCLogDebug!("Freeing TX with ID {} TX.ID {}", tx_id, tx_id+1); + SCLogDebug!("Freeing TX with ID {} TX.ID {}", tx_id, tx_id + 1); let len = self.transactions.len(); let mut found = false; let mut index = 0; for i in 0..len { let tx = &self.transactions[i]; - if tx.id == tx_id { //+ 1 { + if tx.id == tx_id { + //+ 1 { found = true; index = i; SCLogDebug!("tx {} progress {}/{}", tx.id, tx.req_done, tx.resp_done); @@ -113,8 +114,14 @@ impl DCERPCUDPState { } } if found { - SCLogDebug!("freeing TX with ID {} TX.ID {} at index {} left: {} max id: {}", - tx_id, tx_id+1, index, self.transactions.len(), self.tx_id); + SCLogDebug!( + "freeing TX with ID {} TX.ID {} at index {} left: {} max id: {}", + tx_id, + tx_id + 1, + index, + self.transactions.len(), + self.tx_id + ); self.tx_index_completed = 0; self.transactions.remove(index); } @@ -142,8 +149,18 @@ impl DCERPCUDPState { fn find_incomplete_tx(&mut self, hdr: &DCERPCHdrUdp) -> Option<&mut DCERPCTransaction> { for tx in &mut self.transactions { - if tx.seqnum == hdr.seqnum && tx.activityuuid == hdr.activityuuid && ((hdr.pkt_type == DCERPC_TYPE_REQUEST && !tx.req_done) || (hdr.pkt_type == DCERPC_TYPE_RESPONSE && !tx.resp_done)) { - SCLogDebug!("found tx id {}, last tx_id {}, {} {}", tx.id, self.tx_id, tx.seqnum, tx.activityuuid[0]); + if tx.seqnum == hdr.seqnum + && tx.activityuuid == hdr.activityuuid + && ((hdr.pkt_type == DCERPC_TYPE_REQUEST && !tx.req_done) + || (hdr.pkt_type == DCERPC_TYPE_RESPONSE && !tx.resp_done)) + { + SCLogDebug!( + "found tx id {}, last tx_id {}, {} {}", + tx.id, + self.tx_id, + tx.seqnum, + tx.activityuuid[0] + ); return Some(tx); } } @@ -159,7 +176,13 @@ impl DCERPCUDPState { let mut otx = self.find_incomplete_tx(hdr); if otx.is_none() { let ntx = self.create_tx(hdr); - SCLogDebug!("new tx id {}, last tx_id {}, {} {}", ntx.id, self.tx_id, ntx.seqnum, ntx.activityuuid[0]); + SCLogDebug!( + "new tx id {}, last tx_id {}, {} {}", + ntx.id, + self.tx_id, + ntx.seqnum, + ntx.activityuuid[0] + ); self.transactions.push_back(ntx); otx = self.transactions.back_mut(); } @@ -206,7 +229,11 @@ impl DCERPCUDPState { return AppLayerResult::err(); } if leftover_bytes.len() < header.fraglen as usize { - SCLogDebug!("Insufficient data: leftover_bytes {}, fraglen {}", leftover_bytes.len(), header.fraglen); + SCLogDebug!( + "Insufficient data: leftover_bytes {}, fraglen {}", + leftover_bytes.len(), + header.fraglen + ); return AppLayerResult::err(); } if !self.handle_fragment_data(&header, &leftover_bytes[..header.fraglen as usize]) { @@ -229,10 +256,9 @@ impl DCERPCUDPState { } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_udp_parse( +pub unsafe extern fn rs_dcerpc_udp_parse( _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, DCERPCUDPState); if !stream_slice.is_gap() { @@ -242,19 +268,21 @@ pub unsafe extern "C" fn rs_dcerpc_udp_parse( } #[no_mangle] -pub extern "C" fn rs_dcerpc_udp_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_dcerpc_udp_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(unsafe { Box::from_raw(state as *mut DCERPCUDPState) }); } #[no_mangle] -pub extern "C" fn rs_dcerpc_udp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_dcerpc_udp_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: core::AppProto, +) -> *mut std::os::raw::c_void { let state = DCERPCUDPState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_udp_state_transaction_free( +pub unsafe extern fn rs_dcerpc_udp_state_transaction_free( state: *mut std::os::raw::c_void, tx_id: u64, ) { let dce_state = cast_pointer!(state, DCERPCUDPState); @@ -263,31 +291,30 @@ pub unsafe extern "C" fn rs_dcerpc_udp_state_transaction_free( } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_udp_get_tx_data( - tx: *mut std::os::raw::c_void) - -> *mut AppLayerTxData -{ +pub unsafe extern fn rs_dcerpc_udp_get_tx_data( + tx: *mut std::os::raw::c_void, +) -> *mut AppLayerTxData { let tx = cast_pointer!(tx, DCERPCTransaction); return &mut tx.tx_data; } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_udp_get_tx( +pub unsafe extern fn rs_dcerpc_udp_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let dce_state = cast_pointer!(state, DCERPCUDPState); match dce_state.get_tx(tx_id) { Some(tx) => { return tx as *const _ as *mut _; - }, + } None => { return std::ptr::null_mut(); } - } + } } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_udp_get_tx_cnt(vtx: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_dcerpc_udp_get_tx_cnt(vtx: *mut std::os::raw::c_void) -> u64 { let dce_state = cast_pointer!(vtx, DCERPCUDPState); dce_state.tx_id } @@ -297,19 +324,19 @@ fn probe(input: &[u8]) -> (bool, bool) { match parser::parse_dcerpc_udp_header(input) { Ok((_, hdr)) => { let is_request = hdr.pkt_type == 0x00; - let is_dcerpc = hdr.rpc_vers == 0x04 && - (hdr.flags2 & 0xfc == 0) && - (hdr.drep[0] & 0xee == 0) && - (hdr.drep[1] <= 3); + let is_dcerpc = hdr.rpc_vers == 0x04 + && (hdr.flags2 & 0xfc == 0) + && (hdr.drep[0] & 0xee == 0) + && (hdr.drep[1] <= 3); return (is_dcerpc, is_request); - }, + } Err(_) => (false, false), } } -pub unsafe extern "C" fn rs_dcerpc_probe_udp(_f: *const core::Flow, direction: u8, input: *const u8, - len: u32, rdir: *mut u8) -> core::AppProto -{ +pub unsafe extern fn rs_dcerpc_probe_udp( + _f: *const core::Flow, direction: u8, input: *const u8, len: u32, rdir: *mut u8, +) -> core::AppProto { SCLogDebug!("Probing the packet for DCERPC/UDP"); if len == 0 { return core::ALPROTO_UNKNOWN; @@ -333,9 +360,18 @@ pub unsafe extern "C" fn rs_dcerpc_probe_udp(_f: *const core::Flow, direction: u fn register_pattern_probe() -> i8 { unsafe { - if AppLayerProtoDetectPMRegisterPatternCSwPP(core::IPPROTO_UDP, ALPROTO_DCERPC, - b"|04 00|\0".as_ptr() as *const std::os::raw::c_char, 2, 0, - Direction::ToServer.into(), rs_dcerpc_probe_udp, 0, 0) < 0 { + if AppLayerProtoDetectPMRegisterPatternCSwPP( + core::IPPROTO_UDP, + ALPROTO_DCERPC, + b"|04 00|\0".as_ptr() as *const std::os::raw::c_char, + 2, + 0, + Direction::ToServer.into(), + rs_dcerpc_probe_udp, + 0, + 0, + ) < 0 + { SCLogDebug!("TOSERVER => AppLayerProtoDetectPMRegisterPatternCSwPP FAILED"); return -1; } @@ -346,7 +382,7 @@ fn register_pattern_probe() -> i8 { export_state_data_get!(rs_dcerpc_udp_get_state_data, DCERPCUDPState); #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_udp_register_parser() { +pub unsafe extern fn rs_dcerpc_udp_register_parser() { let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, default_port: std::ptr::null(), @@ -395,7 +431,6 @@ pub unsafe extern "C" fn rs_dcerpc_udp_register_parser() { } } - #[cfg(test)] mod tests { use crate::applayer::AppLayerResult; @@ -412,7 +447,7 @@ mod tests { match parser::parse_dcerpc_udp_header(request) { Ok((_rem, _header)) => { - { assert!(false); } + assert!(false); } _ => {} } @@ -433,7 +468,9 @@ mod tests { assert_eq!(4, header.rpc_vers); assert_eq!(80, request.len() - rem.len()); } - _ => { assert!(false); } + _ => { + assert!(false); + } } } @@ -453,7 +490,9 @@ mod tests { assert_eq!(80, request.len() - rem.len()); assert_eq!(0, rem.len()); } - _ => { assert!(false); } + _ => { + assert!(false); + } } } diff --git a/rust/src/dcerpc/detect.rs b/rust/src/dcerpc/detect.rs index 81f2854ace6d..4428fe2287d8 100644 --- a/rust/src/dcerpc/detect.rs +++ b/rust/src/dcerpc/detect.rs @@ -203,7 +203,7 @@ fn parse_opnum_data(arg: &str) -> Result { } #[no_mangle] -pub extern "C" fn rs_dcerpc_iface_match( +pub extern fn rs_dcerpc_iface_match( tx: &mut DCERPCTransaction, state: &mut DCERPCState, if_data: &mut DCEIfaceData, ) -> u8 { let first_req_seen = tx.get_first_req_seen(); @@ -227,7 +227,7 @@ pub extern "C" fn rs_dcerpc_iface_match( } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_iface_parse(carg: *const c_char) -> *mut c_void { +pub unsafe extern fn rs_dcerpc_iface_parse(carg: *const c_char) -> *mut c_void { if carg.is_null() { return std::ptr::null_mut(); } @@ -245,14 +245,14 @@ pub unsafe extern "C" fn rs_dcerpc_iface_parse(carg: *const c_char) -> *mut c_vo } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_iface_free(ptr: *mut c_void) { +pub unsafe extern fn rs_dcerpc_iface_free(ptr: *mut c_void) { if !ptr.is_null() { std::mem::drop(Box::from_raw(ptr as *mut DCEIfaceData)); } } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_opnum_match( +pub unsafe extern fn rs_dcerpc_opnum_match( tx: &mut DCERPCTransaction, opnum_data: &mut DCEOpnumData, ) -> u8 { let first_req_seen = tx.get_first_req_seen(); @@ -274,7 +274,7 @@ pub unsafe extern "C" fn rs_dcerpc_opnum_match( } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_opnum_parse(carg: *const c_char) -> *mut c_void { +pub unsafe extern fn rs_dcerpc_opnum_parse(carg: *const c_char) -> *mut c_void { if carg.is_null() { return std::ptr::null_mut(); } @@ -292,7 +292,7 @@ pub unsafe extern "C" fn rs_dcerpc_opnum_parse(carg: *const c_char) -> *mut c_vo } #[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_opnum_free(ptr: *mut c_void) { +pub unsafe extern fn rs_dcerpc_opnum_free(ptr: *mut c_void) { if !ptr.is_null() { std::mem::drop(Box::from_raw(ptr as *mut DCEOpnumData)); } diff --git a/rust/src/dcerpc/log.rs b/rust/src/dcerpc/log.rs index 3e7322780342..9eebb32b1c3d 100644 --- a/rust/src/dcerpc/log.rs +++ b/rust/src/dcerpc/log.rs @@ -117,7 +117,9 @@ fn log_dcerpc_header_udp( jsb.set_string("response", "UNREPLIED")?; } let activityuuid = Uuid::from_slice(tx.activityuuid.as_slice()); - let activityuuid = activityuuid.map(|uuid| uuid.to_hyphenated().to_string()).unwrap(); + let activityuuid = activityuuid + .map(|uuid| uuid.to_hyphenated().to_string()) + .unwrap(); jsb.set_string("activityuuid", &activityuuid)?; jsb.set_uint("seqnum", tx.seqnum as u64)?; jsb.set_string("rpc_version", "4.0")?; @@ -125,14 +127,14 @@ fn log_dcerpc_header_udp( } #[no_mangle] -pub extern "C" fn rs_dcerpc_log_json_record_tcp( +pub extern fn rs_dcerpc_log_json_record_tcp( state: &DCERPCState, tx: &DCERPCTransaction, jsb: &mut JsonBuilder, ) -> bool { log_dcerpc_header_tcp(jsb, state, tx).is_ok() } #[no_mangle] -pub extern "C" fn rs_dcerpc_log_json_record_udp( +pub extern fn rs_dcerpc_log_json_record_udp( state: &DCERPCUDPState, tx: &DCERPCTransaction, jsb: &mut JsonBuilder, ) -> bool { log_dcerpc_header_udp(jsb, state, tx).is_ok() diff --git a/rust/src/dcerpc/mod.rs b/rust/src/dcerpc/mod.rs index 800d2ade7311..68dbaf6899ca 100644 --- a/rust/src/dcerpc/mod.rs +++ b/rust/src/dcerpc/mod.rs @@ -19,6 +19,6 @@ pub mod dcerpc; pub mod dcerpc_udp; -pub mod parser; pub mod detect; pub mod log; +pub mod parser; diff --git a/rust/src/dcerpc/parser.rs b/rust/src/dcerpc/parser.rs index 256259843f72..232b41b3662c 100644 --- a/rust/src/dcerpc/parser.rs +++ b/rust/src/dcerpc/parser.rs @@ -20,9 +20,9 @@ use crate::dcerpc::dcerpc::{ use crate::dcerpc::dcerpc_udp::DCERPCHdrUdp; use nom7::bytes::streaming::take; use nom7::combinator::cond; +use nom7::multi::count; use nom7::number::complete::{le_u16, le_u32, le_u8, u16, u32}; use nom7::number::Endianness; -use nom7::multi::count; use nom7::IResult; fn uuid_to_vec(uuid: Uuid) -> Vec { @@ -77,7 +77,11 @@ pub fn parse_dcerpc_udp_header(i: &[u8]) -> IResult<&[u8], DCERPCHdrUdp> { let (i, flags1) = le_u8(i)?; let (i, flags2) = le_u8(i)?; let (i, drep) = take(3_usize)(i)?; - let endianness = if drep[0] == 0 { Endianness::Big } else { Endianness::Little }; + let endianness = if drep[0] == 0 { + Endianness::Big + } else { + Endianness::Little + }; let (i, serial_hi) = le_u8(i)?; let (i, objectuuid) = take(16_usize)(i)?; let (i, interfaceuuid) = take(16_usize)(i)?; @@ -104,21 +108,21 @@ pub fn parse_dcerpc_udp_header(i: &[u8]) -> IResult<&[u8], DCERPCHdrUdp> { Err(_e) => { SCLogDebug!("{}", _e); vec![0] - }, + } }, interfaceuuid: match parse_uuid(interfaceuuid) { Ok((_, vect)) => assemble_uuid(vect), Err(_e) => { SCLogDebug!("{}", _e); vec![0] - }, + } }, - activityuuid: match parse_uuid(activityuuid){ + activityuuid: match parse_uuid(activityuuid) { Ok((_, vect)) => assemble_uuid(vect), Err(_e) => { SCLogDebug!("{}", _e); vec![0] - }, + } }, server_boot, if_vers, @@ -136,9 +140,9 @@ pub fn parse_dcerpc_udp_header(i: &[u8]) -> IResult<&[u8], DCERPCHdrUdp> { pub fn parse_dcerpc_bindack_result(i: &[u8]) -> IResult<&[u8], DCERPCBindAckResult> { let (i, ack_result) = le_u16(i)?; - let (i, ack_reason) = le_u16(i)?; - let (i, transfer_syntax) = take(16_usize)(i)?; - let (i, syntax_version) = le_u32(i)?; + let (i, ack_reason) = le_u16(i)?; + let (i, transfer_syntax) = take(16_usize)(i)?; + let (i, syntax_version) = le_u32(i)?; let result = DCERPCBindAckResult { ack_result, ack_reason, @@ -154,7 +158,9 @@ pub fn parse_dcerpc_bindack(i: &[u8]) -> IResult<&[u8], DCERPCBindAck> { let (i, _assoc_group) = take(4_usize)(i)?; let (i, sec_addr_len) = le_u16(i)?; let (i, _) = take(sec_addr_len)(i)?; - let (i, _) = cond((sec_addr_len.wrapping_add(2)) % 4 != 0, |b| take(4 - (sec_addr_len.wrapping_add(2)) % 4)(b))(i)?; + let (i, _) = cond((sec_addr_len.wrapping_add(2)) % 4 != 0, |b| { + take(4 - (sec_addr_len.wrapping_add(2)) % 4)(b) + })(i)?; let (i, numctxitems) = le_u8(i)?; let (i, _) = take(3_usize)(i)?; // Padding let (i, ctxitems) = count(parse_dcerpc_bindack_result, numctxitems as usize)(i)?; @@ -184,7 +190,9 @@ pub fn parse_bindctx_item(i: &[u8], endianness: Endianness) -> IResult<&[u8], Bi _ => uuid_to_vec(vect), }, // Shouldn't happen - Err(_e) => {vec![0]}, + Err(_e) => { + vec![0] + } }, version, versionminor, @@ -211,7 +219,11 @@ pub fn parse_dcerpc_header(i: &[u8]) -> IResult<&[u8], DCERPCHdr> { let (i, hdrtype) = le_u8(i)?; let (i, pfc_flags) = le_u8(i)?; let (i, packed_drep) = take(4_usize)(i)?; - let endianness = if packed_drep[0] & 0x10 == 0 { Endianness::Big } else { Endianness::Little }; + let endianness = if packed_drep[0] & 0x10 == 0 { + Endianness::Big + } else { + Endianness::Little + }; let (i, frag_length) = u16(endianness)(i)?; let (i, auth_length) = u16(endianness)(i)?; let (i, call_id) = u32(endianness)(i)?; diff --git a/rust/src/detect/byte_math.rs b/rust/src/detect/byte_math.rs index 80bd3d5ee178..9983ed2b23af 100644 --- a/rust/src/detect/byte_math.rs +++ b/rust/src/detect/byte_math.rs @@ -420,7 +420,7 @@ fn parse_bytemath(input: &str) -> IResult<&str, DetectByteMathData, RuleParseErr /// Intermediary function between the C code and the parsing functions. #[no_mangle] -pub unsafe extern "C" fn ScByteMathParse(c_arg: *const c_char) -> *mut DetectByteMathData { +pub unsafe extern fn ScByteMathParse(c_arg: *const c_char) -> *mut DetectByteMathData { if c_arg.is_null() { return std::ptr::null_mut(); } @@ -438,7 +438,7 @@ pub unsafe extern "C" fn ScByteMathParse(c_arg: *const c_char) -> *mut DetectByt } #[no_mangle] -pub unsafe extern "C" fn ScByteMathFree(ptr: *mut DetectByteMathData) { +pub unsafe extern fn ScByteMathFree(ptr: *mut DetectByteMathData) { if !ptr.is_null() { let _ = Box::from_raw(ptr); } @@ -491,8 +491,9 @@ mod tests { } fn valid_test( - args: &str, nbytes: u8, offset: i32, oper: ByteMathOperator, rvalue_str: &str, nbytes_str: &str, rvalue: u32, - result: &str, base: ByteMathBase, endian: ByteMathEndian, bitmask_val: u32, flags: u8, + args: &str, nbytes: u8, offset: i32, oper: ByteMathOperator, rvalue_str: &str, + nbytes_str: &str, rvalue: u32, result: &str, base: ByteMathBase, endian: ByteMathEndian, + bitmask_val: u32, flags: u8, ) { let bmd = DetectByteMathData { nbytes, @@ -673,24 +674,18 @@ mod tests { #[test] fn test_parser_string_invalid() { - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, string decimal" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, string hexadecimal" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, string octal" - ) - .is_err() - ); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, string decimal" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, string hexadecimal" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, string octal" + ) + .is_err()); } #[test] @@ -712,50 +707,38 @@ mod tests { #[test] fn test_parser_bitmask_invalid() { - assert!( - parse_bytemath("bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0x") - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask x12345678" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask X12345678" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0x123456789012" - ) - .is_err() - ); - assert!( - parse_bytemath("bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0q") - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask maple" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0xGHIJKLMN" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask #*#*@-" - ) - .is_err() - ); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0x" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask x12345678" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask X12345678" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0x123456789012" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0q" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask maple" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask 0xGHIJKLMN" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, bitmask #*#*@-" + ) + .is_err()); } #[test] @@ -871,38 +854,28 @@ mod tests { #[test] fn test_parser_endian_invalid() { - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian bigger" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian smaller" - ) - .is_err() - ); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian bigger" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian smaller" + ) + .is_err()); // endianess can only be specified once - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian big, dce" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian small, endian big" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian small, dce" - ) - .is_err() - ); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian big, dce" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian small, endian big" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 3933, oper +, rvalue myrvalue, result foo, endian small, dce" + ) + .is_err()); } #[test] @@ -979,24 +952,12 @@ mod tests { #[test] fn test_parser_oper_invalid() { - assert!( - parse_bytemath("bytes 4, offset 0, oper !, rvalue myvalue, result foo").is_err() - ); - assert!( - parse_bytemath("bytes 4, offset 0, oper ^, rvalue myvalue, result foo").is_err() - ); - assert!( - parse_bytemath("bytes 4, offset 0, oper <>, rvalue myvalue, result foo").is_err() - ); - assert!( - parse_bytemath("bytes 4, offset 0, oper ><, rvalue myvalue, result foo").is_err() - ); - assert!( - parse_bytemath("bytes 4, offset 0, oper <, rvalue myvalue, result foo").is_err() - ); - assert!( - parse_bytemath("bytes 4, offset 0, oper >, rvalue myvalue, result foo").is_err() - ); + assert!(parse_bytemath("bytes 4, offset 0, oper !, rvalue myvalue, result foo").is_err()); + assert!(parse_bytemath("bytes 4, offset 0, oper ^, rvalue myvalue, result foo").is_err()); + assert!(parse_bytemath("bytes 4, offset 0, oper <>, rvalue myvalue, result foo").is_err()); + assert!(parse_bytemath("bytes 4, offset 0, oper ><, rvalue myvalue, result foo").is_err()); + assert!(parse_bytemath("bytes 4, offset 0, oper <, rvalue myvalue, result foo").is_err()); + assert!(parse_bytemath("bytes 4, offset 0, oper >, rvalue myvalue, result foo").is_err()); } #[test] @@ -1115,9 +1076,7 @@ mod tests { parse_bytemath("bytes 4, offset 3933, endian big, rvalue myrvalue, result foo") .is_err() ); - assert!( - parse_bytemath("bytes 4, offset 3933, oper +, endian big, result foo").is_err() - ); + assert!(parse_bytemath("bytes 4, offset 3933, oper +, endian big, result foo").is_err()); assert!( parse_bytemath("bytes 4, offset 3933, oper +, rvalue myrvalue, endian big").is_err() ); @@ -1129,35 +1088,30 @@ mod tests { assert!(parse_bytemath("bytes nan").is_err()); assert!(parse_bytemath("bytes 4, offset nan").is_err()); assert!(parse_bytemath("bytes 4, offset 0, three 3, four 4, five 5, six 6, seven 7, eight 8, nine 9, ten 10, eleven 11").is_err()); - assert!( - parse_bytemath("bytes 4, offset 0, oper ><, rvalue myrvalue").is_err() - ); + assert!(parse_bytemath("bytes 4, offset 0, oper ><, rvalue myrvalue").is_err()); assert!( parse_bytemath("bytes 4, offset 0, oper +, rvalue myrvalue, endian endian").is_err() ); } #[test] fn test_parser_multiple() { - assert!( - parse_bytemath( - "bytes 4, bytes 4, offset 0, oper +, rvalue myrvalue, result myresult, endian big" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 0, offset 0, oper +, rvalue myrvalue, result myresult, endian big" - ) - .is_err() - ); - assert!( - parse_bytemath( - "bytes 4, offset 0, oper +, oper +, rvalue myrvalue, result myresult, endian big" - ) - .is_err() - ); + assert!(parse_bytemath( + "bytes 4, bytes 4, offset 0, oper +, rvalue myrvalue, result myresult, endian big" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 0, offset 0, oper +, rvalue myrvalue, result myresult, endian big" + ) + .is_err()); + assert!(parse_bytemath( + "bytes 4, offset 0, oper +, oper +, rvalue myrvalue, result myresult, endian big" + ) + .is_err()); assert!(parse_bytemath("bytes 4, offset 0, oper +, rvalue myrvalue, rvalue myrvalue, result myresult, endian big").is_err()); assert!(parse_bytemath("bytes 4, offset 0, oper +, rvalue myrvalue, result myresult, result myresult, endian big").is_err()); - assert!(parse_bytemath("bytes 4, offset 0, oper +, rvalue myrvalue, result myresult, endian big, endian big").is_err()); + assert!(parse_bytemath( + "bytes 4, offset 0, oper +, rvalue myrvalue, result myresult, endian big, endian big" + ) + .is_err()); } } diff --git a/rust/src/detect/iprep.rs b/rust/src/detect/iprep.rs index 16f5d9d5d15e..5b4bf6ae7e3a 100644 --- a/rust/src/detect/iprep.rs +++ b/rust/src/detect/iprep.rs @@ -71,7 +71,7 @@ pub fn is_alphanumeric_or_slash(chr: char) -> bool { return false; } -extern "C" { +extern { pub fn SRepCatGetByShortname(name: *const c_char) -> u8; } @@ -108,7 +108,7 @@ pub fn detect_parse_iprep(i: &str) -> IResult<&str, DetectIPRepData> { } #[no_mangle] -pub unsafe extern "C" fn rs_detect_iprep_parse( +pub unsafe extern fn rs_detect_iprep_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectIPRepData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -122,7 +122,7 @@ pub unsafe extern "C" fn rs_detect_iprep_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_iprep_free(ctx: &mut DetectIPRepData) { +pub unsafe extern fn rs_detect_iprep_free(ctx: &mut DetectIPRepData) { // Just unbox... std::mem::drop(Box::from_raw(ctx)); } diff --git a/rust/src/detect/stream_size.rs b/rust/src/detect/stream_size.rs index cb8c826697a7..7dff6cd2a860 100644 --- a/rust/src/detect/stream_size.rs +++ b/rust/src/detect/stream_size.rs @@ -78,7 +78,7 @@ pub fn detect_parse_stream_size(i: &str) -> IResult<&str, DetectStreamSizeData> } #[no_mangle] -pub unsafe extern "C" fn rs_detect_stream_size_parse( +pub unsafe extern fn rs_detect_stream_size_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectStreamSizeData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -92,7 +92,7 @@ pub unsafe extern "C" fn rs_detect_stream_size_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_stream_size_free(ctx: &mut DetectStreamSizeData) { +pub unsafe extern fn rs_detect_stream_size_free(ctx: &mut DetectStreamSizeData) { // Just unbox... std::mem::drop(Box::from_raw(ctx)); } diff --git a/rust/src/detect/uint.rs b/rust/src/detect/uint.rs index 3d6a5baab0ca..580c55f52c6e 100644 --- a/rust/src/detect/uint.rs +++ b/rust/src/detect/uint.rs @@ -270,7 +270,7 @@ pub fn detect_parse_uint_inclusive(i: &str) -> IResult<&str, D } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u64_parse( +pub unsafe extern fn rs_detect_u64_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectUintData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -284,7 +284,7 @@ pub unsafe extern "C" fn rs_detect_u64_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u64_match( +pub unsafe extern fn rs_detect_u64_match( arg: u64, ctx: &DetectUintData, ) -> std::os::raw::c_int { if detect_match_uint(ctx, arg) { @@ -294,13 +294,13 @@ pub unsafe extern "C" fn rs_detect_u64_match( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u64_free(ctx: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_detect_u64_free(ctx: *mut std::os::raw::c_void) { // Just unbox... std::mem::drop(Box::from_raw(ctx as *mut DetectUintData)); } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u32_parse( +pub unsafe extern fn rs_detect_u32_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectUintData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -314,7 +314,7 @@ pub unsafe extern "C" fn rs_detect_u32_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u32_parse_inclusive( +pub unsafe extern fn rs_detect_u32_parse_inclusive( ustr: *const std::os::raw::c_char, ) -> *mut DetectUintData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -328,7 +328,7 @@ pub unsafe extern "C" fn rs_detect_u32_parse_inclusive( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u32_match( +pub unsafe extern fn rs_detect_u32_match( arg: u32, ctx: &DetectUintData, ) -> std::os::raw::c_int { if detect_match_uint(ctx, arg) { @@ -338,13 +338,13 @@ pub unsafe extern "C" fn rs_detect_u32_match( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u32_free(ctx: &mut DetectUintData) { +pub unsafe extern fn rs_detect_u32_free(ctx: &mut DetectUintData) { // Just unbox... std::mem::drop(Box::from_raw(ctx)); } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u8_parse( +pub unsafe extern fn rs_detect_u8_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectUintData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -358,9 +358,7 @@ pub unsafe extern "C" fn rs_detect_u8_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u8_match( - arg: u8, ctx: &DetectUintData, -) -> std::os::raw::c_int { +pub unsafe extern fn rs_detect_u8_match(arg: u8, ctx: &DetectUintData) -> std::os::raw::c_int { if detect_match_uint(ctx, arg) { return 1; } @@ -368,13 +366,13 @@ pub unsafe extern "C" fn rs_detect_u8_match( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u8_free(ctx: &mut DetectUintData) { +pub unsafe extern fn rs_detect_u8_free(ctx: &mut DetectUintData) { // Just unbox... std::mem::drop(Box::from_raw(ctx)); } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u16_parse( +pub unsafe extern fn rs_detect_u16_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectUintData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -388,7 +386,7 @@ pub unsafe extern "C" fn rs_detect_u16_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u16_match( +pub unsafe extern fn rs_detect_u16_match( arg: u16, ctx: &DetectUintData, ) -> std::os::raw::c_int { if detect_match_uint(ctx, arg) { @@ -398,7 +396,7 @@ pub unsafe extern "C" fn rs_detect_u16_match( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_u16_free(ctx: &mut DetectUintData) { +pub unsafe extern fn rs_detect_u16_free(ctx: &mut DetectUintData) { // Just unbox... std::mem::drop(Box::from_raw(ctx)); } diff --git a/rust/src/detect/uri.rs b/rust/src/detect/uri.rs index ae982782cc4d..65ed53680ea5 100644 --- a/rust/src/detect/uri.rs +++ b/rust/src/detect/uri.rs @@ -58,7 +58,7 @@ pub fn detect_parse_urilen(i: &str) -> IResult<&str, DetectUrilenData> { } #[no_mangle] -pub unsafe extern "C" fn rs_detect_urilen_parse( +pub unsafe extern fn rs_detect_urilen_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectUrilenData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -72,7 +72,7 @@ pub unsafe extern "C" fn rs_detect_urilen_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_detect_urilen_free(ctx: &mut DetectUrilenData) { +pub unsafe extern fn rs_detect_urilen_free(ctx: &mut DetectUrilenData) { // Just unbox... std::mem::drop(Box::from_raw(ctx)); } diff --git a/rust/src/dhcp/detect.rs b/rust/src/dhcp/detect.rs index 0215810ae847..e31cad4b2f7e 100644 --- a/rust/src/dhcp/detect.rs +++ b/rust/src/dhcp/detect.rs @@ -21,9 +21,7 @@ use super::dhcp::{ use super::parser::DHCPOptionWrapper; #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_tx_get_leasetime( - tx: &mut DHCPTransaction, leasetime: *mut u64, -) -> u8 { +pub unsafe extern fn rs_dhcp_tx_get_leasetime(tx: &mut DHCPTransaction, leasetime: *mut u64) -> u8 { for option in &tx.message.options { if option.code == DHCP_OPT_ADDRESS_TIME { if let DHCPOptionWrapper::TimeValue(ref time_value) = option.option { @@ -36,9 +34,7 @@ pub unsafe extern "C" fn rs_dhcp_tx_get_leasetime( } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_tx_get_rebinding_time( - tx: &mut DHCPTransaction, res: *mut u64, -) -> u8 { +pub unsafe extern fn rs_dhcp_tx_get_rebinding_time(tx: &mut DHCPTransaction, res: *mut u64) -> u8 { for option in &tx.message.options { if option.code == DHCP_OPT_REBINDING_TIME { if let DHCPOptionWrapper::TimeValue(ref time_value) = option.option { @@ -51,9 +47,7 @@ pub unsafe extern "C" fn rs_dhcp_tx_get_rebinding_time( } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_tx_get_renewal_time( - tx: &mut DHCPTransaction, res: *mut u64, -) -> u8 { +pub unsafe extern fn rs_dhcp_tx_get_renewal_time(tx: &mut DHCPTransaction, res: *mut u64) -> u8 { for option in &tx.message.options { if option.code == DHCP_OPT_RENEWAL_TIME { if let DHCPOptionWrapper::TimeValue(ref time_value) = option.option { diff --git a/rust/src/dhcp/dhcp.rs b/rust/src/dhcp/dhcp.rs index b69b675b8ce9..0d576b8c4d45 100644 --- a/rust/src/dhcp/dhcp.rs +++ b/rust/src/dhcp/dhcp.rs @@ -17,7 +17,7 @@ use crate::applayer::{self, *}; use crate::core; -use crate::core::{ALPROTO_UNKNOWN, AppProto, Flow, IPPROTO_UDP}; +use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_UDP}; use crate::dhcp::parser::*; use std; use std::ffi::CString; @@ -178,12 +178,9 @@ impl DHCPState { } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_probing_parser(_flow: *const Flow, - _direction: u8, - input: *const u8, - input_len: u32, - _rdir: *mut u8) -> AppProto -{ +pub unsafe extern fn rs_dhcp_probing_parser( + _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, +) -> AppProto { if input_len < DHCP_MIN_FRAME_LEN { return ALPROTO_UNKNOWN; } @@ -200,15 +197,17 @@ pub unsafe extern "C" fn rs_dhcp_probing_parser(_flow: *const Flow, } #[no_mangle] -pub extern "C" fn rs_dhcp_tx_get_alstate_progress(_tx: *mut std::os::raw::c_void, - _direction: u8) -> std::os::raw::c_int { +pub extern fn rs_dhcp_tx_get_alstate_progress( + _tx: *mut std::os::raw::c_void, _direction: u8, +) -> std::os::raw::c_int { // As this is a stateless parser, simply use 1. return 1; } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_state_get_tx(state: *mut std::os::raw::c_void, - tx_id: u64) -> *mut std::os::raw::c_void { +pub unsafe extern fn rs_dhcp_state_get_tx( + state: *mut std::os::raw::c_void, tx_id: u64, +) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, DHCPState); match state.get_tx(tx_id) { Some(tx) => { @@ -221,18 +220,16 @@ pub unsafe extern "C" fn rs_dhcp_state_get_tx(state: *mut std::os::raw::c_void, } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_dhcp_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, DHCPState); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_parse(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { +pub unsafe extern fn rs_dhcp_parse( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let state = cast_pointer!(state, DHCPState); if state.parse(stream_slice.as_slice()) { return AppLayerResult::ok(); @@ -241,23 +238,22 @@ pub unsafe extern "C" fn rs_dhcp_parse(_flow: *const core::Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_state_tx_free( - state: *mut std::os::raw::c_void, - tx_id: u64) -{ +pub unsafe extern fn rs_dhcp_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, DHCPState); state.free_tx(tx_id); } #[no_mangle] -pub extern "C" fn rs_dhcp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_dhcp_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = DHCPState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_state_free(state: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_dhcp_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(Box::from_raw(state as *mut DHCPState)); } @@ -267,38 +263,38 @@ export_state_data_get!(rs_dhcp_get_state_data, DHCPState); const PARSER_NAME: &[u8] = b"dhcp\0"; #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_register_parser() { +pub unsafe extern fn rs_dhcp_register_parser() { SCLogDebug!("Registering DHCP parser."); let ports = CString::new("[67,68]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, - default_port : ports.as_ptr(), - ipproto : IPPROTO_UDP, - probe_ts : Some(rs_dhcp_probing_parser), - probe_tc : Some(rs_dhcp_probing_parser), - min_depth : 0, - max_depth : 16, - state_new : rs_dhcp_state_new, - state_free : rs_dhcp_state_free, - tx_free : rs_dhcp_state_tx_free, - parse_ts : rs_dhcp_parse, - parse_tc : rs_dhcp_parse, - get_tx_count : rs_dhcp_state_get_tx_count, - get_tx : rs_dhcp_state_get_tx, - tx_comp_st_ts : 1, - tx_comp_st_tc : 1, - tx_get_progress : rs_dhcp_tx_get_alstate_progress, - get_eventinfo : Some(DHCPEvent::get_event_info), - get_eventinfo_byid : Some(DHCPEvent::get_event_info_by_id), - localstorage_new : None, - localstorage_free : None, - get_tx_files : None, - get_tx_iterator : Some(applayer::state_get_tx_iterator::), - get_tx_data : rs_dhcp_get_tx_data, - get_state_data : rs_dhcp_get_state_data, - apply_tx_config : None, - flags : 0, - truncate : None, + default_port: ports.as_ptr(), + ipproto: IPPROTO_UDP, + probe_ts: Some(rs_dhcp_probing_parser), + probe_tc: Some(rs_dhcp_probing_parser), + min_depth: 0, + max_depth: 16, + state_new: rs_dhcp_state_new, + state_free: rs_dhcp_state_free, + tx_free: rs_dhcp_state_tx_free, + parse_ts: rs_dhcp_parse, + parse_tc: rs_dhcp_parse, + get_tx_count: rs_dhcp_state_get_tx_count, + get_tx: rs_dhcp_state_get_tx, + tx_comp_st_ts: 1, + tx_comp_st_tc: 1, + tx_get_progress: rs_dhcp_tx_get_alstate_progress, + get_eventinfo: Some(DHCPEvent::get_event_info), + get_eventinfo_byid: Some(DHCPEvent::get_event_info_by_id), + localstorage_new: None, + localstorage_free: None, + get_tx_files: None, + get_tx_iterator: Some(applayer::state_get_tx_iterator::), + get_tx_data: rs_dhcp_get_tx_data, + get_state_data: rs_dhcp_get_state_data, + apply_tx_config: None, + flags: 0, + truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/dhcp/logger.rs b/rust/src/dhcp/logger.rs index b29e2158ef95..43e0df539931 100644 --- a/rust/src/dhcp/logger.rs +++ b/rust/src/dhcp/logger.rs @@ -18,10 +18,10 @@ use std; use std::os::raw::c_void; +use crate::conf::ConfNode; use crate::dhcp::dhcp::*; -use crate::dhcp::parser::{DHCPOptionWrapper,DHCPOptGeneric}; +use crate::dhcp::parser::{DHCPOptGeneric, DHCPOptionWrapper}; use crate::dns::log::dns_print_addr; -use crate::conf::ConfNode; use crate::jsonbuilder::{JsonBuilder, JsonError}; pub struct DHCPLogger { @@ -29,11 +29,10 @@ pub struct DHCPLogger { } impl DHCPLogger { - pub fn new(conf: ConfNode) -> Self { return Self { extended: conf.get_child_bool("extended"), - } + }; } fn get_type(&self, tx: &DHCPTransaction) -> Option { @@ -42,7 +41,8 @@ impl DHCPLogger { let code = option.code; #[allow(clippy::single_match)] match &option.option { - DHCPOptionWrapper::Generic(option) => { + DHCPOptionWrapper::Generic(option) => + { #[allow(clippy::single_match)] match code { DHCP_OPT_TYPE => { @@ -61,7 +61,7 @@ impl DHCPLogger { pub fn do_log(&self, tx: &DHCPTransaction) -> bool { if !self.extended { - if let Some(DHCP_TYPE_ACK) = self.get_type(tx){ + if let Some(DHCP_TYPE_ACK) = self.get_type(tx) { return true; } return false; @@ -86,101 +86,86 @@ impl DHCPLogger { js.set_string("type", "")?; } } - + js.set_uint("id", header.txid as u64)?; - js.set_string("client_mac", - &format_addr_hex(&header.clienthw.to_vec()))?; + js.set_string("client_mac", &format_addr_hex(&header.clienthw.to_vec()))?; js.set_string("assigned_ip", &dns_print_addr(&header.yourip))?; if self.extended { js.set_string("client_ip", &dns_print_addr(&header.clientip))?; if header.opcode == BOOTP_REPLY { - js.set_string("relay_ip", - &dns_print_addr(&header.giaddr))?; - js.set_string("next_server_ip", - &dns_print_addr(&header.serverip))?; + js.set_string("relay_ip", &dns_print_addr(&header.giaddr))?; + js.set_string("next_server_ip", &dns_print_addr(&header.serverip))?; } } - + for option in options { let code = option.code; match option.option { DHCPOptionWrapper::ClientId(ref clientid) => { - js.set_string("client_id", - &format_addr_hex(&clientid.data))?; + js.set_string("client_id", &format_addr_hex(&clientid.data))?; } - DHCPOptionWrapper::TimeValue(ref time_value) => { - match code { - DHCP_OPT_ADDRESS_TIME => { - if self.extended { - js.set_uint("lease_time", - time_value.seconds as u64)?; - } - } - DHCP_OPT_REBINDING_TIME => { - if self.extended { - js.set_uint("rebinding_time", - time_value.seconds as u64)?; - } - } - DHCP_OPT_RENEWAL_TIME => { - js.set_uint("renewal_time", - time_value.seconds as u64)?; + DHCPOptionWrapper::TimeValue(ref time_value) => match code { + DHCP_OPT_ADDRESS_TIME => { + if self.extended { + js.set_uint("lease_time", time_value.seconds as u64)?; } - _ => {} } - } - DHCPOptionWrapper::Generic(ref option) => { - match code { - DHCP_OPT_SUBNET_MASK => { - if self.extended { - js.set_string("subnet_mask", - &dns_print_addr(&option.data))?; - } + DHCP_OPT_REBINDING_TIME => { + if self.extended { + js.set_uint("rebinding_time", time_value.seconds as u64)?; } - DHCP_OPT_HOSTNAME => { - if !option.data.is_empty() { - js.set_string_from_bytes("hostname", - &option.data)?; - } + } + DHCP_OPT_RENEWAL_TIME => { + js.set_uint("renewal_time", time_value.seconds as u64)?; + } + _ => {} + }, + DHCPOptionWrapper::Generic(ref option) => match code { + DHCP_OPT_SUBNET_MASK => { + if self.extended { + js.set_string("subnet_mask", &dns_print_addr(&option.data))?; } - DHCP_OPT_TYPE => { - self.log_opt_type(js, option)?; + } + DHCP_OPT_HOSTNAME => { + if !option.data.is_empty() { + js.set_string_from_bytes("hostname", &option.data)?; } - DHCP_OPT_REQUESTED_IP => { - if self.extended { - js.set_string("requested_ip", - &dns_print_addr(&option.data))?; - } + } + DHCP_OPT_TYPE => { + self.log_opt_type(js, option)?; + } + DHCP_OPT_REQUESTED_IP => { + if self.extended { + js.set_string("requested_ip", &dns_print_addr(&option.data))?; } - DHCP_OPT_PARAMETER_LIST => { - if self.extended { - self.log_opt_parameters(js, option)?; - } + } + DHCP_OPT_PARAMETER_LIST => { + if self.extended { + self.log_opt_parameters(js, option)?; } - DHCP_OPT_DNS_SERVER => { - if self.extended { - self.log_opt_dns_server(js, option)?; - } + } + DHCP_OPT_DNS_SERVER => { + if self.extended { + self.log_opt_dns_server(js, option)?; } - DHCP_OPT_ROUTERS => { - if self.extended { - self.log_opt_routers(js, option)?; - } + } + DHCP_OPT_ROUTERS => { + if self.extended { + self.log_opt_routers(js, option)?; } - DHCP_OPT_VENDOR_CLASS_ID => { - if self.extended && !option.data.is_empty(){ - js.set_string_from_bytes("vendor_class_identifier", - &option.data)?; - } + } + DHCP_OPT_VENDOR_CLASS_ID => { + if self.extended && !option.data.is_empty() { + js.set_string_from_bytes("vendor_class_identifier", &option.data)?; } - _ => {} } - } + _ => {} + }, _ => {} } } - + js.close()?; return Ok(()); @@ -197,14 +182,16 @@ impl DHCPLogger { DHCP_TYPE_NAK => "nak", DHCP_TYPE_RELEASE => "release", DHCP_TYPE_INFORM => "inform", - _ => "unknown" + _ => "unknown", }; js.set_string("dhcp_type", dhcp_type)?; } Ok(()) } - fn log_opt_parameters(&self, js: &mut JsonBuilder, option: &DHCPOptGeneric) -> Result<(), JsonError> { + fn log_opt_parameters( + &self, js: &mut JsonBuilder, option: &DHCPOptGeneric, + ) -> Result<(), JsonError> { js.open_array("params")?; for i in &option.data { let param = match *i { @@ -216,7 +203,7 @@ impl DHCPLogger { DHCP_PARAM_NTP_SERVER => "ntp_server", DHCP_PARAM_TFTP_SERVER_NAME => "tftp_server_name", DHCP_PARAM_TFTP_SERVER_IP => "tftp_server_ip", - _ => "" + _ => "", }; if !param.is_empty() { js.append_string(param)?; @@ -225,8 +212,10 @@ impl DHCPLogger { js.close()?; Ok(()) } - - fn log_opt_dns_server(&self, js: &mut JsonBuilder, option: &DHCPOptGeneric) -> Result<(), JsonError> { + + fn log_opt_dns_server( + &self, js: &mut JsonBuilder, option: &DHCPOptGeneric, + ) -> Result<(), JsonError> { js.open_array("dns_servers")?; for i in 0..(option.data.len() / 4) { let val = dns_print_addr(&option.data[(i * 4)..(i * 4) + 4].to_vec()); @@ -235,8 +224,10 @@ impl DHCPLogger { js.close()?; Ok(()) } - - fn log_opt_routers(&self, js: &mut JsonBuilder, option: &DHCPOptGeneric) -> Result<(), JsonError> { + + fn log_opt_routers( + &self, js: &mut JsonBuilder, option: &DHCPOptGeneric, + ) -> Result<(), JsonError> { js.open_array("routers")?; for i in 0..(option.data.len() / 4) { let val = dns_print_addr(&option.data[(i * 4)..(i * 4) + 4].to_vec()); @@ -245,41 +236,38 @@ impl DHCPLogger { js.close()?; Ok(()) } - } fn format_addr_hex(input: &[u8]) -> String { - let parts: Vec = input.iter() - .map(|b| format!("{:02x}", b)) - .collect(); + let parts: Vec = input.iter().map(|b| format!("{:02x}", b)).collect(); return parts.join(":"); } #[no_mangle] -pub extern "C" fn rs_dhcp_logger_new(conf: *const c_void) -> *mut std::os::raw::c_void { +pub extern fn rs_dhcp_logger_new(conf: *const c_void) -> *mut std::os::raw::c_void { let conf = ConfNode::wrap(conf); let boxed = Box::new(DHCPLogger::new(conf)); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_logger_free(logger: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_dhcp_logger_free(logger: *mut std::os::raw::c_void) { std::mem::drop(Box::from_raw(logger as *mut DHCPLogger)); } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_logger_log(logger: *mut std::os::raw::c_void, - tx: *mut std::os::raw::c_void, - js: &mut JsonBuilder) -> bool { +pub unsafe extern fn rs_dhcp_logger_log( + logger: *mut std::os::raw::c_void, tx: *mut std::os::raw::c_void, js: &mut JsonBuilder, +) -> bool { let logger = cast_pointer!(logger, DHCPLogger); let tx = cast_pointer!(tx, DHCPTransaction); logger.log(tx, js).is_ok() } #[no_mangle] -pub unsafe extern "C" fn rs_dhcp_logger_do_log(logger: *mut std::os::raw::c_void, - tx: *mut std::os::raw::c_void) - -> bool { +pub unsafe extern fn rs_dhcp_logger_do_log( + logger: *mut std::os::raw::c_void, tx: *mut std::os::raw::c_void, +) -> bool { let logger = cast_pointer!(logger, DHCPLogger); let tx = cast_pointer!(tx, DHCPTransaction); logger.do_log(tx) diff --git a/rust/src/dhcp/mod.rs b/rust/src/dhcp/mod.rs index fd783d961ff2..50c993479196 100644 --- a/rust/src/dhcp/mod.rs +++ b/rust/src/dhcp/mod.rs @@ -17,7 +17,7 @@ //! DHCP parser, detection and logger module. +pub mod detect; pub mod dhcp; -pub mod parser; pub mod logger; -pub mod detect; +pub mod parser; diff --git a/rust/src/dns/detect.rs b/rust/src/dns/detect.rs index 268a409eac8d..5be1f2c6592d 100644 --- a/rust/src/dns/detect.rs +++ b/rust/src/dns/detect.rs @@ -57,7 +57,7 @@ fn parse_opcode(opcode: &str) -> Result { /// /// 1 will be returned on match, otherwise 0 will be returned. #[no_mangle] -pub extern "C" fn rs_dns_opcode_match( +pub extern fn rs_dns_opcode_match( tx: &mut DNSTransaction, detect: &mut DetectDnsOpcode, flags: u8, ) -> u8 { let header_flags = if flags & Direction::ToServer as u8 != 0 { @@ -90,7 +90,7 @@ fn match_opcode(detect: &DetectDnsOpcode, flags: u16) -> bool { } #[no_mangle] -pub unsafe extern "C" fn rs_detect_dns_opcode_parse(carg: *const c_char) -> *mut c_void { +pub unsafe extern fn rs_detect_dns_opcode_parse(carg: *const c_char) -> *mut c_void { if carg.is_null() { return std::ptr::null_mut(); } @@ -108,7 +108,7 @@ pub unsafe extern "C" fn rs_detect_dns_opcode_parse(carg: *const c_char) -> *mut } #[no_mangle] -pub unsafe extern "C" fn rs_dns_detect_opcode_free(ptr: *mut c_void) { +pub unsafe extern fn rs_dns_detect_opcode_free(ptr: *mut c_void) { if !ptr.is_null() { std::mem::drop(Box::from_raw(ptr as *mut DetectDnsOpcode)); } @@ -156,44 +156,36 @@ mod test { #[test] fn test_match_opcode() { - assert!( - match_opcode( - &DetectDnsOpcode { - negate: false, - opcode: 0, - }, - 0b0000_0000_0000_0000, - ) - ); + assert!(match_opcode( + &DetectDnsOpcode { + negate: false, + opcode: 0, + }, + 0b0000_0000_0000_0000, + )); - assert!( - !match_opcode( - &DetectDnsOpcode { - negate: true, - opcode: 0, - }, - 0b0000_0000_0000_0000, - ) - ); + assert!(!match_opcode( + &DetectDnsOpcode { + negate: true, + opcode: 0, + }, + 0b0000_0000_0000_0000, + )); - assert!( - match_opcode( - &DetectDnsOpcode { - negate: false, - opcode: 4, - }, - 0b0010_0000_0000_0000, - ) - ); + assert!(match_opcode( + &DetectDnsOpcode { + negate: false, + opcode: 4, + }, + 0b0010_0000_0000_0000, + )); - assert!( - !match_opcode( - &DetectDnsOpcode { - negate: true, - opcode: 4, - }, - 0b0010_0000_0000_0000, - ) - ); + assert!(!match_opcode( + &DetectDnsOpcode { + negate: true, + opcode: 4, + }, + 0b0010_0000_0000_0000, + )); } } diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index 382c76ae59b5..b87333885b92 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -250,10 +250,10 @@ impl Transaction for DNSTransaction { impl DNSTransaction { pub fn new(direction: Direction) -> Self { - Self { - tx_data: AppLayerTxData::for_direction(direction), + Self { + tx_data: AppLayerTxData::for_direction(direction), ..Default::default() - } + } } /// Get the DNS transactions ID (not the internal tracking ID). @@ -733,7 +733,7 @@ pub fn probe_tcp(input: &[u8]) -> (bool, bool, bool) { /// Returns *mut DNSState #[no_mangle] -pub extern "C" fn rs_dns_state_new( +pub extern fn rs_dns_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = DNSState::new(); @@ -743,7 +743,7 @@ pub extern "C" fn rs_dns_state_new( /// Returns *mut DNSState #[no_mangle] -pub extern "C" fn rs_dns_state_tcp_new() -> *mut std::os::raw::c_void { +pub extern fn rs_dns_state_tcp_new() -> *mut std::os::raw::c_void { let state = DNSState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; @@ -752,20 +752,20 @@ pub extern "C" fn rs_dns_state_tcp_new() -> *mut std::os::raw::c_void { /// Params: /// - state: *mut DNSState as void pointer #[no_mangle] -pub extern "C" fn rs_dns_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_dns_state_free(state: *mut std::os::raw::c_void) { // Just unbox... std::mem::drop(unsafe { Box::from_raw(state as *mut DNSState) }); } #[no_mangle] -pub unsafe extern "C" fn rs_dns_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_dns_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, DNSState); state.free_tx(tx_id); } /// C binding parse a DNS request. Returns 1 on success, -1 on failure. #[no_mangle] -pub unsafe extern "C" fn rs_dns_parse_request( +pub unsafe extern fn rs_dns_parse_request( flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -775,7 +775,7 @@ pub unsafe extern "C" fn rs_dns_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_dns_parse_response( +pub unsafe extern fn rs_dns_parse_response( flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -786,7 +786,7 @@ pub unsafe extern "C" fn rs_dns_parse_response( /// C binding parse a DNS request. Returns 1 on success, -1 on failure. #[no_mangle] -pub unsafe extern "C" fn rs_dns_parse_request_tcp( +pub unsafe extern fn rs_dns_parse_request_tcp( flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -800,7 +800,7 @@ pub unsafe extern "C" fn rs_dns_parse_request_tcp( } #[no_mangle] -pub unsafe extern "C" fn rs_dns_parse_response_tcp( +pub unsafe extern fn rs_dns_parse_response_tcp( flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -814,7 +814,7 @@ pub unsafe extern "C" fn rs_dns_parse_response_tcp( } #[no_mangle] -pub extern "C" fn rs_dns_tx_get_alstate_progress( +pub extern fn rs_dns_tx_get_alstate_progress( _tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { // This is a stateless parser, just the existence of a transaction @@ -824,14 +824,14 @@ pub extern "C" fn rs_dns_tx_get_alstate_progress( } #[no_mangle] -pub unsafe extern "C" fn rs_dns_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_dns_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, DNSState); SCLogDebug!("rs_dns_state_get_tx_count: returning {}", state.tx_id); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_dns_state_get_tx( +pub unsafe extern fn rs_dns_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, DNSState); @@ -846,16 +846,16 @@ pub unsafe extern "C" fn rs_dns_state_get_tx( } #[no_mangle] -pub extern "C" fn rs_dns_tx_is_request(tx: &mut DNSTransaction) -> bool { +pub extern fn rs_dns_tx_is_request(tx: &mut DNSTransaction) -> bool { tx.request.is_some() } #[no_mangle] -pub extern "C" fn rs_dns_tx_is_response(tx: &mut DNSTransaction) -> bool { +pub extern fn rs_dns_tx_is_response(tx: &mut DNSTransaction) -> bool { tx.response.is_some() } -pub unsafe extern "C" fn rs_dns_state_get_tx_data( +pub unsafe extern fn rs_dns_state_get_tx_data( tx: *mut std::os::raw::c_void, ) -> *mut AppLayerTxData { let tx = cast_pointer!(tx, DNSTransaction); @@ -865,7 +865,7 @@ pub unsafe extern "C" fn rs_dns_state_get_tx_data( export_state_data_get!(rs_dns_get_state_data, DNSState); #[no_mangle] -pub unsafe extern "C" fn rs_dns_tx_get_query_name( +pub unsafe extern fn rs_dns_tx_get_query_name( tx: &mut DNSTransaction, i: u32, buf: *mut *const u8, len: *mut u32, ) -> u8 { if let Some(request) = &tx.request { @@ -885,7 +885,7 @@ pub unsafe extern "C" fn rs_dns_tx_get_query_name( // /// extern uint16_t rs_dns_tx_get_tx_id(RSDNSTransaction *); #[no_mangle] -pub extern "C" fn rs_dns_tx_get_tx_id(tx: &mut DNSTransaction) -> u16 { +pub extern fn rs_dns_tx_get_tx_id(tx: &mut DNSTransaction) -> u16 { return tx.tx_id(); } @@ -893,12 +893,12 @@ pub extern "C" fn rs_dns_tx_get_tx_id(tx: &mut DNSTransaction) -> u16 { /// /// extern uint16_t rs_dns_tx_get_response_flags(RSDNSTransaction *); #[no_mangle] -pub extern "C" fn rs_dns_tx_get_response_flags(tx: &mut DNSTransaction) -> u16 { +pub extern fn rs_dns_tx_get_response_flags(tx: &mut DNSTransaction) -> u16 { return tx.rcode(); } #[no_mangle] -pub unsafe extern "C" fn rs_dns_tx_get_query_rrtype( +pub unsafe extern fn rs_dns_tx_get_query_rrtype( tx: &mut DNSTransaction, i: u16, rrtype: *mut u16, ) -> u8 { if let Some(request) = &tx.request { @@ -914,7 +914,7 @@ pub unsafe extern "C" fn rs_dns_tx_get_query_rrtype( } #[no_mangle] -pub unsafe extern "C" fn rs_dns_probe( +pub unsafe extern fn rs_dns_probe( _flow: *const core::Flow, _dir: u8, input: *const u8, len: u32, rdir: *mut u8, ) -> AppProto { if len == 0 || len < std::mem::size_of::() as u32 { @@ -935,7 +935,7 @@ pub unsafe extern "C" fn rs_dns_probe( } #[no_mangle] -pub unsafe extern "C" fn rs_dns_probe_tcp( +pub unsafe extern fn rs_dns_probe_tcp( _flow: *const core::Flow, direction: u8, input: *const u8, len: u32, rdir: *mut u8, ) -> AppProto { if len == 0 || len < std::mem::size_of::() as u32 + 2 { @@ -959,7 +959,7 @@ pub unsafe extern "C" fn rs_dns_probe_tcp( } #[no_mangle] -pub unsafe extern "C" fn rs_dns_apply_tx_config( +pub unsafe extern fn rs_dns_apply_tx_config( _state: *mut std::os::raw::c_void, _tx: *mut std::os::raw::c_void, _mode: std::os::raw::c_int, config: AppLayerTxConfig, ) { @@ -976,7 +976,7 @@ pub unsafe extern "C" fn rs_dns_apply_tx_config( } #[no_mangle] -pub unsafe extern "C" fn rs_dns_udp_register_parser() { +pub unsafe extern fn rs_dns_udp_register_parser() { let default_port = std::ffi::CString::new("[53]").unwrap(); let parser = RustParser { name: b"dns\0".as_ptr() as *const std::os::raw::c_char, @@ -1022,7 +1022,7 @@ pub unsafe extern "C" fn rs_dns_udp_register_parser() { } #[no_mangle] -pub unsafe extern "C" fn rs_dns_tcp_register_parser() { +pub unsafe extern fn rs_dns_tcp_register_parser() { let default_port = std::ffi::CString::new("53").unwrap(); let parser = RustParser { name: b"dns\0".as_ptr() as *const std::os::raw::c_char, diff --git a/rust/src/dns/log.rs b/rust/src/dns/log.rs index 5212b1a0da7c..b56c8645f15f 100644 --- a/rust/src/dns/log.rs +++ b/rust/src/dns/log.rs @@ -524,7 +524,8 @@ fn dns_log_json_answer( match &answer.data { DNSRData::A(addr) | DNSRData::AAAA(addr) => { if !answer_types.contains_key(&type_string) { - answer_types.insert(type_string.to_string(), JsonBuilder::try_new_array()?); + answer_types + .insert(type_string.to_string(), JsonBuilder::try_new_array()?); } if let Some(a) = answer_types.get_mut(&type_string) { a.append_string(&dns_print_addr(addr))?; @@ -537,7 +538,8 @@ fn dns_log_json_answer( | DNSRData::NULL(bytes) | DNSRData::PTR(bytes) => { if !answer_types.contains_key(&type_string) { - answer_types.insert(type_string.to_string(), JsonBuilder::try_new_array()?); + answer_types + .insert(type_string.to_string(), JsonBuilder::try_new_array()?); } if let Some(a) = answer_types.get_mut(&type_string) { a.append_string_from_bytes(bytes)?; @@ -545,7 +547,8 @@ fn dns_log_json_answer( } DNSRData::SOA(soa) => { if !answer_types.contains_key(&type_string) { - answer_types.insert(type_string.to_string(), JsonBuilder::try_new_array()?); + answer_types + .insert(type_string.to_string(), JsonBuilder::try_new_array()?); } if let Some(a) = answer_types.get_mut(&type_string) { a.append_object(&dns_log_soa(soa)?)?; @@ -553,7 +556,8 @@ fn dns_log_json_answer( } DNSRData::SSHFP(sshfp) => { if !answer_types.contains_key(&type_string) { - answer_types.insert(type_string.to_string(), JsonBuilder::try_new_array()?); + answer_types + .insert(type_string.to_string(), JsonBuilder::try_new_array()?); } if let Some(a) = answer_types.get_mut(&type_string) { a.append_object(&dns_log_sshfp(sshfp)?)?; @@ -561,7 +565,8 @@ fn dns_log_json_answer( } DNSRData::SRV(srv) => { if !answer_types.contains_key(&type_string) { - answer_types.insert(type_string.to_string(), JsonBuilder::try_new_array()?); + answer_types + .insert(type_string.to_string(), JsonBuilder::try_new_array()?); } if let Some(a) = answer_types.get_mut(&type_string) { a.append_object(&dns_log_srv(srv)?)?; @@ -631,7 +636,7 @@ fn dns_log_query( } #[no_mangle] -pub extern "C" fn rs_dns_log_json_query( +pub extern fn rs_dns_log_json_query( tx: &mut DNSTransaction, i: u16, flags: u64, jb: &mut JsonBuilder, ) -> bool { match dns_log_query(tx, i, flags, jb) { @@ -645,7 +650,7 @@ pub extern "C" fn rs_dns_log_json_query( } #[no_mangle] -pub extern "C" fn rs_dns_log_json_answer( +pub extern fn rs_dns_log_json_answer( tx: &mut DNSTransaction, flags: u64, js: &mut JsonBuilder, ) -> bool { if let Some(response) = &tx.response { @@ -659,7 +664,7 @@ pub extern "C" fn rs_dns_log_json_answer( } #[no_mangle] -pub extern "C" fn rs_dns_do_log_answer(tx: &mut DNSTransaction, flags: u64) -> bool { +pub extern fn rs_dns_do_log_answer(tx: &mut DNSTransaction, flags: u64) -> bool { if let Some(response) = &tx.response { for query in &response.queries { if dns_log_rrtype_enabled(query.rrtype, flags) { diff --git a/rust/src/dns/lua.rs b/rust/src/dns/lua.rs index b9935f87da84..fd7f128667c1 100644 --- a/rust/src/dns/lua.rs +++ b/rust/src/dns/lua.rs @@ -22,14 +22,14 @@ use crate::dns::log::*; use crate::lua::*; #[no_mangle] -pub extern "C" fn rs_dns_lua_get_tx_id(clua: &mut CLuaState, tx: &mut DNSTransaction) { +pub extern fn rs_dns_lua_get_tx_id(clua: &mut CLuaState, tx: &mut DNSTransaction) { let lua = LuaState { lua: clua }; lua.pushinteger(tx.tx_id() as i64); } #[no_mangle] -pub extern "C" fn rs_dns_lua_get_rrname(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int { +pub extern fn rs_dns_lua_get_rrname(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int { let lua = LuaState { lua: clua }; if let Some(request) = &tx.request { @@ -48,7 +48,7 @@ pub extern "C" fn rs_dns_lua_get_rrname(clua: &mut CLuaState, tx: &mut DNSTransa } #[no_mangle] -pub extern "C" fn rs_dns_lua_get_rcode(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int { +pub extern fn rs_dns_lua_get_rcode(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int { let lua = LuaState { lua: clua }; let rcode = tx.rcode(); @@ -61,9 +61,7 @@ pub extern "C" fn rs_dns_lua_get_rcode(clua: &mut CLuaState, tx: &mut DNSTransac } #[no_mangle] -pub extern "C" fn rs_dns_lua_get_query_table( - clua: &mut CLuaState, tx: &mut DNSTransaction, -) -> c_int { +pub extern fn rs_dns_lua_get_query_table(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int { let lua = LuaState { lua: clua }; let mut i: i64 = 0; @@ -116,9 +114,7 @@ pub extern "C" fn rs_dns_lua_get_query_table( } #[no_mangle] -pub extern "C" fn rs_dns_lua_get_answer_table( - clua: &mut CLuaState, tx: &mut DNSTransaction, -) -> c_int { +pub extern fn rs_dns_lua_get_answer_table(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int { let lua = LuaState { lua: clua }; let mut i: i64 = 0; @@ -195,7 +191,7 @@ pub extern "C" fn rs_dns_lua_get_answer_table( } #[no_mangle] -pub extern "C" fn rs_dns_lua_get_authority_table( +pub extern fn rs_dns_lua_get_authority_table( clua: &mut CLuaState, tx: &mut DNSTransaction, ) -> c_int { let lua = LuaState { lua: clua }; diff --git a/rust/src/ffi/base64.rs b/rust/src/ffi/base64.rs index ea72a344c393..2c4ee0faf505 100644 --- a/rust/src/ffi/base64.rs +++ b/rust/src/ffi/base64.rs @@ -15,8 +15,8 @@ * 02110-1301, USA. */ -use std::os::raw::c_uchar; use libc::c_ulong; +use std::os::raw::c_uchar; #[repr(C)] #[allow(non_camel_case_types)] @@ -35,7 +35,7 @@ pub enum Base64ReturnCode { /// from Base64EncodeBufferSize for the input_len, and this length must be provided /// in the output_len variable. #[no_mangle] -pub unsafe extern "C" fn Base64Encode( +pub unsafe extern fn Base64Encode( input: *const u8, input_len: c_ulong, output: *mut c_uchar, output_len: *mut c_ulong, ) -> Base64ReturnCode { if input.is_null() || output.is_null() || output_len.is_null() { @@ -57,6 +57,6 @@ pub unsafe extern "C" fn Base64Encode( /// required output bytes are 4 * ceil(input_len / 3) and an additional byte for /// storing the NULL pointer. #[no_mangle] -pub extern "C" fn Base64EncodeBufferSize(len: c_ulong) -> c_ulong { +pub extern fn Base64EncodeBufferSize(len: c_ulong) -> c_ulong { (4 * ((len) + 2) / 3) + 1 } diff --git a/rust/src/ffi/hashing.rs b/rust/src/ffi/hashing.rs index 59c7c9d3e970..dc259791dd83 100644 --- a/rust/src/ffi/hashing.rs +++ b/rust/src/ffi/hashing.rs @@ -34,18 +34,18 @@ pub const SC_SHA256_HEX_LEN: usize = 64; pub struct SCSha256(Sha256); #[no_mangle] -pub extern "C" fn SCSha256New() -> *mut SCSha256 { +pub extern fn SCSha256New() -> *mut SCSha256 { let hasher = Box::new(SCSha256(Sha256::new())); Box::into_raw(hasher) } #[no_mangle] -pub unsafe extern "C" fn SCSha256Update(hasher: &mut SCSha256, bytes: *const u8, len: u32) { +pub unsafe extern fn SCSha256Update(hasher: &mut SCSha256, bytes: *const u8, len: u32) { update(&mut hasher.0, bytes, len); } #[no_mangle] -pub unsafe extern "C" fn SCSha256Finalize(hasher: &mut SCSha256, out: *mut u8, len: u32) { +pub unsafe extern fn SCSha256Finalize(hasher: &mut SCSha256, out: *mut u8, len: u32) { let hasher: Box = Box::from_raw(hasher); finalize(hasher.0, out, len); } @@ -59,7 +59,7 @@ pub unsafe extern "C" fn SCSha256Finalize(hasher: &mut SCSha256, out: *mut u8, l /// But even given the notes, this appears to be faster than the equivalent that we /// did in C using NSS. #[no_mangle] -pub unsafe extern "C" fn SCSha256FinalizeToHex(hasher: &mut SCSha256, out: *mut c_char, len: u32) { +pub unsafe extern fn SCSha256FinalizeToHex(hasher: &mut SCSha256, out: *mut c_char, len: u32) { let hasher: Box = Box::from_raw(hasher); let result = hasher.0.finalize(); let hex = format!("{:x}", &result); @@ -68,13 +68,13 @@ pub unsafe extern "C" fn SCSha256FinalizeToHex(hasher: &mut SCSha256, out: *mut /// Free an unfinalized Sha256 context. #[no_mangle] -pub unsafe extern "C" fn SCSha256Free(hasher: &mut SCSha256) { +pub unsafe extern fn SCSha256Free(hasher: &mut SCSha256) { // Drop. let _: Box = Box::from_raw(hasher); } #[no_mangle] -pub unsafe extern "C" fn SCSha256HashBuffer( +pub unsafe extern fn SCSha256HashBuffer( buf: *const u8, buf_len: u32, out: *mut u8, len: u32, ) -> bool { if len as usize != SC_SHA256_LEN { @@ -92,31 +92,31 @@ pub unsafe extern "C" fn SCSha256HashBuffer( pub struct SCSha1(Sha1); #[no_mangle] -pub extern "C" fn SCSha1New() -> *mut SCSha1 { +pub extern fn SCSha1New() -> *mut SCSha1 { let hasher = Box::new(SCSha1(Sha1::new())); Box::into_raw(hasher) } #[no_mangle] -pub unsafe extern "C" fn SCSha1Update(hasher: &mut SCSha1, bytes: *const u8, len: u32) { +pub unsafe extern fn SCSha1Update(hasher: &mut SCSha1, bytes: *const u8, len: u32) { update(&mut hasher.0, bytes, len); } #[no_mangle] -pub unsafe extern "C" fn SCSha1Finalize(hasher: &mut SCSha1, out: *mut u8, len: u32) { +pub unsafe extern fn SCSha1Finalize(hasher: &mut SCSha1, out: *mut u8, len: u32) { let hasher: Box = Box::from_raw(hasher); finalize(hasher.0, out, len); } /// Free an unfinalized Sha1 context. #[no_mangle] -pub unsafe extern "C" fn SCSha1Free(hasher: &mut SCSha1) { +pub unsafe extern fn SCSha1Free(hasher: &mut SCSha1) { // Drop. let _: Box = Box::from_raw(hasher); } #[no_mangle] -pub unsafe extern "C" fn SCSha1HashBuffer( +pub unsafe extern fn SCSha1HashBuffer( buf: *const u8, buf_len: u32, out: *mut u8, len: u32, ) -> bool { if len as usize != SC_SHA1_LEN { @@ -134,13 +134,13 @@ pub unsafe extern "C" fn SCSha1HashBuffer( pub struct SCMd5(Md5); #[no_mangle] -pub extern "C" fn SCMd5New() -> *mut SCMd5 { +pub extern fn SCMd5New() -> *mut SCMd5 { let hasher = Box::new(SCMd5(Md5::new())); Box::into_raw(hasher) } #[no_mangle] -pub unsafe extern "C" fn SCMd5Update(hasher: &mut SCMd5, bytes: *const u8, len: u32) { +pub unsafe extern fn SCMd5Update(hasher: &mut SCMd5, bytes: *const u8, len: u32) { update(&mut hasher.0, bytes, len); } @@ -148,7 +148,7 @@ pub unsafe extern "C" fn SCMd5Update(hasher: &mut SCMd5, bytes: *const u8, len: /// /// This function consumes the SCMd5 hash context. #[no_mangle] -pub unsafe extern "C" fn SCMd5Finalize(hasher: &mut SCMd5, out: *mut u8, len: u32) { +pub unsafe extern fn SCMd5Finalize(hasher: &mut SCMd5, out: *mut u8, len: u32) { let hasher: Box = Box::from_raw(hasher); finalize(hasher.0, out, len); } @@ -157,7 +157,7 @@ pub unsafe extern "C" fn SCMd5Finalize(hasher: &mut SCMd5, out: *mut u8, len: u3 /// /// Consumes the hash context and cannot be re-used. #[no_mangle] -pub unsafe extern "C" fn SCMd5FinalizeToHex(hasher: &mut SCMd5, out: *mut c_char, len: u32) { +pub unsafe extern fn SCMd5FinalizeToHex(hasher: &mut SCMd5, out: *mut c_char, len: u32) { let hasher: Box = Box::from_raw(hasher); let result = hasher.0.finalize(); let hex = format!("{:x}", &result); @@ -166,13 +166,13 @@ pub unsafe extern "C" fn SCMd5FinalizeToHex(hasher: &mut SCMd5, out: *mut c_char /// Free an unfinalized Sha1 context. #[no_mangle] -pub unsafe extern "C" fn SCMd5Free(hasher: &mut SCMd5) { +pub unsafe extern fn SCMd5Free(hasher: &mut SCMd5) { // Drop. let _: Box = Box::from_raw(hasher); } #[no_mangle] -pub unsafe extern "C" fn SCMd5HashBuffer(buf: *const u8, buf_len: u32, out: *mut u8, len: u32) { +pub unsafe extern fn SCMd5HashBuffer(buf: *const u8, buf_len: u32, out: *mut u8, len: u32) { let data = std::slice::from_raw_parts(buf, buf_len as usize); let output = std::slice::from_raw_parts_mut(out, len as usize); let hash = Md5::new().chain(data).finalize(); @@ -181,7 +181,7 @@ pub unsafe extern "C" fn SCMd5HashBuffer(buf: *const u8, buf_len: u32, out: *mut /// C binding for a function to MD5 hash a single buffer to a hex string. #[no_mangle] -pub unsafe extern "C" fn SCMd5HashBufferToHex( +pub unsafe extern fn SCMd5HashBufferToHex( buf: *const u8, buf_len: u32, out: *mut c_char, len: u32, ) { let data = std::slice::from_raw_parts(buf, buf_len as usize); @@ -223,9 +223,18 @@ mod test { SCSha256Update(hasher, bytes.as_ptr(), bytes.len() as u32); SCSha256Update(hasher, bytes.as_ptr(), bytes.len() as u32); let hex = [0_u8; SC_SHA256_HEX_LEN + 1]; - SCSha256FinalizeToHex(hasher, hex.as_ptr() as *mut c_char, (SC_SHA256_HEX_LEN + 1) as u32); - let string = std::ffi::CStr::from_ptr(hex.as_ptr() as *mut c_char).to_str().unwrap(); - assert_eq!(string, "22a48051594c1949deed7040850c1f0f8764537f5191be56732d16a54c1d8153"); + SCSha256FinalizeToHex( + hasher, + hex.as_ptr() as *mut c_char, + (SC_SHA256_HEX_LEN + 1) as u32, + ); + let string = std::ffi::CStr::from_ptr(hex.as_ptr() as *mut c_char) + .to_str() + .unwrap(); + assert_eq!( + string, + "22a48051594c1949deed7040850c1f0f8764537f5191be56732d16a54c1d8153" + ); } } @@ -243,10 +252,15 @@ mod test { SCMd5Update(hasher, bytes.as_ptr(), bytes.len() as u32); SCMd5Update(hasher, bytes.as_ptr(), bytes.len() as u32); let hex = [0_u8; SC_MD5_HEX_LEN + 1]; - SCMd5FinalizeToHex(hasher, hex.as_ptr() as *mut c_char, (SC_MD5_HEX_LEN + 1) as u32); - let string = std::ffi::CStr::from_ptr(hex.as_ptr() as *mut c_char).to_str().unwrap(); + SCMd5FinalizeToHex( + hasher, + hex.as_ptr() as *mut c_char, + (SC_MD5_HEX_LEN + 1) as u32, + ); + let string = std::ffi::CStr::from_ptr(hex.as_ptr() as *mut c_char) + .to_str() + .unwrap(); assert_eq!(string, "5216ddcc58e8dade5256075e77f642da"); } } - } diff --git a/rust/src/ffi/mod.rs b/rust/src/ffi/mod.rs index e97e6c98c639..cdd57a19676e 100644 --- a/rust/src/ffi/mod.rs +++ b/rust/src/ffi/mod.rs @@ -17,6 +17,6 @@ //! Module that exposes C bindings to the Suricata Rust library. -pub mod hashing; pub mod base64; +pub mod hashing; pub mod strings; diff --git a/rust/src/filecontainer.rs b/rust/src/filecontainer.rs index 3a8bde5f7d5b..7525a39df6f4 100644 --- a/rust/src/filecontainer.rs +++ b/rust/src/filecontainer.rs @@ -17,8 +17,8 @@ //! This module handles file container operations (open, append, close). +use std::os::raw::c_void; use std::ptr; -use std::os::raw::{c_void}; use crate::core::*; @@ -30,76 +30,101 @@ extern { #[repr(C)] #[derive(Debug)] pub struct FileContainer { - head: * mut c_void, - tail: * mut c_void, + head: *mut c_void, + tail: *mut c_void, } impl Default for FileContainer { - fn default() -> Self { Self { - head: ptr::null_mut(), - tail: ptr::null_mut(), - }} + fn default() -> Self { + Self { + head: ptr::null_mut(), + tail: ptr::null_mut(), + } + } } impl FileContainer { pub fn free(&mut self, cfg: &'static SuricataFileContext) { SCLogDebug!("freeing self"); - if let Some(c) = unsafe {SC} { + if let Some(c) = unsafe { SC } { (c.FileContainerRecycle)(self, cfg.files_sbcfg); } } - pub fn file_open(&mut self, cfg: &'static SuricataFileContext, track_id: u32, name: &[u8], flags: u16) -> i32 { - match unsafe {SC} { + pub fn file_open( + &mut self, cfg: &'static SuricataFileContext, track_id: u32, name: &[u8], flags: u16, + ) -> i32 { + match unsafe { SC } { None => panic!("BUG no suricata_config"), Some(c) => { SCLogDebug!("FILE {:p} OPEN flags {:04X}", &self, flags); - let res = (c.FileOpenFile)(self, cfg.files_sbcfg, track_id, - name.as_ptr(), name.len() as u16, - ptr::null(), 0u32, flags); + let res = (c.FileOpenFile)( + self, + cfg.files_sbcfg, + track_id, + name.as_ptr(), + name.len() as u16, + ptr::null(), + 0u32, + flags, + ); res } } } - pub fn file_append(&mut self, cfg: &'static SuricataFileContext, track_id: &u32, data: &[u8], is_gap: bool) -> i32 { + pub fn file_append( + &mut self, cfg: &'static SuricataFileContext, track_id: &u32, data: &[u8], is_gap: bool, + ) -> i32 { SCLogDebug!("FILECONTAINER: append {}", data.len()); if data.is_empty() { - return 0 + return 0; } - match unsafe {SC} { + match unsafe { SC } { None => panic!("BUG no suricata_config"), Some(c) => { let res = match is_gap { false => { SCLogDebug!("appending file data"); - let r = (c.FileAppendData)(self, cfg.files_sbcfg, *track_id, - data.as_ptr(), data.len() as u32); + let r = (c.FileAppendData)( + self, + cfg.files_sbcfg, + *track_id, + data.as_ptr(), + data.len() as u32, + ); r - }, + } true => { SCLogDebug!("appending GAP"); - let r = (c.FileAppendGAP)(self, cfg.files_sbcfg, *track_id, - data.as_ptr(), data.len() as u32); + let r = (c.FileAppendGAP)( + self, + cfg.files_sbcfg, + *track_id, + data.as_ptr(), + data.len() as u32, + ); r - }, + } }; res } } } - pub fn file_close(&mut self, cfg: &'static SuricataFileContext, track_id: &u32, flags: u16) -> i32 { + pub fn file_close( + &mut self, cfg: &'static SuricataFileContext, track_id: &u32, flags: u16, + ) -> i32 { SCLogDebug!("FILECONTAINER: CLOSEing"); - match unsafe {SC} { + match unsafe { SC } { None => panic!("BUG no suricata_config"), Some(c) => { - let res = (c.FileCloseFile)(self, cfg.files_sbcfg, *track_id, ptr::null(), 0u32, flags); + let res = + (c.FileCloseFile)(self, cfg.files_sbcfg, *track_id, ptr::null(), 0u32, flags); res } } - } } diff --git a/rust/src/filetracker.rs b/rust/src/filetracker.rs index 3ae65eecb559..820683662f44 100644 --- a/rust/src/filetracker.rs +++ b/rust/src/filetracker.rs @@ -28,9 +28,9 @@ //! Author: Victor Julien use crate::core::*; -use std::collections::HashMap; -use std::collections::hash_map::Entry::{Occupied, Vacant}; use crate::filecontainer::*; +use std::collections::hash_map::Entry::{Occupied, Vacant}; +use std::collections::HashMap; #[derive(Debug)] struct FileChunk { @@ -47,11 +47,10 @@ impl FileChunk { } } -#[derive(Debug)] -#[derive(Default)] +#[derive(Debug, Default)] pub struct FileTransferTracker { pub tracked: u64, - cur_ooo: u64, // how many bytes do we have queued from ooo chunks + cur_ooo: u64, // how many bytes do we have queued from ooo chunks track_id: u32, chunk_left: u32, @@ -76,7 +75,7 @@ pub struct FileTransferTracker { impl FileTransferTracker { pub fn new() -> FileTransferTracker { FileTransferTracker { - chunks:HashMap::new(), + chunks: HashMap::new(), ..Default::default() } } @@ -89,28 +88,28 @@ impl FileTransferTracker { return self.file_open || self.file_is_truncated || self.file_closed; } - fn open(&mut self, config: &'static SuricataFileContext, name: &[u8]) -> i32 - { - let r = self.file.file_open(config, self.track_id, name, self.file_flags); + fn open(&mut self, config: &'static SuricataFileContext, name: &[u8]) -> i32 { + let r = self + .file + .file_open(config, self.track_id, name, self.file_flags); if r == 0 { self.file_open = true; } r } - pub fn close(&mut self, config: &'static SuricataFileContext) - { + pub fn close(&mut self, config: &'static SuricataFileContext) { if !self.file_is_truncated { SCLogDebug!("closing file with id {}", self.track_id); - self.file.file_close(config, &self.track_id, self.file_flags); + self.file + .file_close(config, &self.track_id, self.file_flags); } self.file_open = false; self.file_closed = true; self.tracked = 0; } - pub fn trunc (&mut self, config: &'static SuricataFileContext) - { + pub fn trunc(&mut self, config: &'static SuricataFileContext) { if self.file_is_truncated || !self.file_open { return; } @@ -123,22 +122,30 @@ impl FileTransferTracker { self.cur_ooo = 0; } - 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 - { + 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 { if self.chunk_left != 0 || self.fill_bytes != 0 { SCLogDebug!("current chunk incomplete: truncating"); self.trunc(config); } - SCLogDebug!("NEW CHUNK: chunk_size {} fill_bytes {}", chunk_size, fill_bytes); + SCLogDebug!( + "NEW CHUNK: chunk_size {} fill_bytes {}", + chunk_size, + fill_bytes + ); // for now assume that is_last means its really the last chunk // so no out of order chunks coming after. This means that if // the last chunk is out or order, we've missed chunks before. if chunk_offset != self.tracked { - SCLogDebug!("NEW CHUNK IS OOO: expected {}, got {}", self.tracked, chunk_offset); + SCLogDebug!( + "NEW CHUNK IS OOO: expected {}, got {}", + self.tracked, + chunk_offset + ); if is_last { SCLogDebug!("last chunk is out of order, this means we missed data before"); self.trunc(config); @@ -172,8 +179,9 @@ impl FileTransferTracker { /// update the file tracker /// If gap_size > 0 'data' should not be used. /// return how much we consumed of data - pub fn update(&mut self, config: &'static SuricataFileContext, data: &[u8], gap_size: u32) -> u32 - { + pub fn update( + &mut self, config: &'static SuricataFileContext, data: &[u8], gap_size: u32, + ) -> u32 { if self.file_is_truncated { let consumed = std::cmp::min(data.len() as u32, self.chunk_left); self.chunk_left = self.chunk_left.saturating_sub(data.len() as u32); @@ -182,7 +190,12 @@ impl FileTransferTracker { let mut consumed = 0_usize; let is_gap = gap_size > 0; if is_gap || gap_size > 0 { - SCLogDebug!("is_gap {} size {} ooo? {}", is_gap, gap_size, self.chunk_is_ooo); + SCLogDebug!( + "is_gap {} size {} ooo? {}", + is_gap, + gap_size, + self.chunk_is_ooo + ); } if self.chunk_left == 0 && self.fill_bytes == 0 { @@ -192,7 +205,7 @@ impl FileTransferTracker { self.close(config); self.chunk_is_last = false; } - return 0 + return 0; } else if self.chunk_left == 0 { SCLogDebug!("FILL BYTES {} from prev run", self.fill_bytes); if data.len() >= self.fill_bytes as usize { @@ -205,7 +218,7 @@ impl FileTransferTracker { SCLogDebug!("CHUNK(pre) fill bytes now still {}", self.fill_bytes); } SCLogDebug!("FILL BYTES: returning {}", consumed); - return consumed as u32 + return consumed as u32; } SCLogDebug!("UPDATE: data {} chunk_left {}", data.len(), self.chunk_left); @@ -216,24 +229,26 @@ impl FileTransferTracker { if !self.chunk_is_ooo { let res = self.file.file_append(config, &self.track_id, d, is_gap); match res { - 0 => { }, - -2 => { + 0 => {} + -2 => { self.file_is_truncated = true; - }, + } _ => { SCLogDebug!("got error so truncating file"); self.file_is_truncated = true; - }, + } } self.tracked += self.chunk_left as u64; } else { - SCLogDebug!("UPDATE: appending data {} to ooo chunk at offset {}/{}", - d.len(), self.cur_ooo_chunk_offset, self.tracked); + SCLogDebug!( + "UPDATE: appending data {} to ooo chunk at offset {}/{}", + d.len(), + self.cur_ooo_chunk_offset, + self.tracked + ); let c = match self.chunks.entry(self.cur_ooo_chunk_offset) { - Vacant(entry) => { - entry.insert(FileChunk::new(self.chunk_left)) - }, + Vacant(entry) => entry.insert(FileChunk::new(self.chunk_left)), Occupied(entry) => entry.into_mut(), }; self.cur_ooo += d.len() as u64; @@ -267,31 +282,42 @@ impl FileTransferTracker { Some(c) => { self.in_flight -= c.chunk.len() as u64; - let res = self.file.file_append(config, &self.track_id, &c.chunk, c.contains_gap); + let res = self.file.file_append( + config, + &self.track_id, + &c.chunk, + c.contains_gap, + ); match res { - 0 => { }, - -2 => { + 0 => {} + -2 => { self.file_is_truncated = true; - }, + } _ => { SCLogDebug!("got error so truncating file"); self.file_is_truncated = true; - }, + } } self.tracked += c.chunk.len() as u64; self.cur_ooo -= c.chunk.len() as u64; SCLogDebug!("STORED OOO CHUNK at offset {}, tracked now {}, stored len {}", _offset, self.tracked, c.chunk.len()); - }, + } _ => { - SCLogDebug!("NO STORED CHUNK found at _offset {}", self.tracked); + SCLogDebug!( + "NO STORED CHUNK found at _offset {}", + self.tracked + ); break; - }, + } }; } } else { - SCLogDebug!("UPDATE: complete ooo chunk. Offset {}", self.cur_ooo_chunk_offset); + SCLogDebug!( + "UPDATE: complete ooo chunk. Offset {}", + self.cur_ooo_chunk_offset + ); self.chunk_is_ooo = false; self.cur_ooo_chunk_offset = 0; @@ -304,19 +330,18 @@ impl FileTransferTracker { } else { SCLogDebug!("NOT last chunk, keep going"); } - } else { if !self.chunk_is_ooo { let res = self.file.file_append(config, &self.track_id, data, is_gap); match res { - 0 => { }, - -2 => { + 0 => {} + -2 => { self.file_is_truncated = true; - }, + } _ => { SCLogDebug!("got error so truncating file"); self.file_is_truncated = true; - }, + } } self.tracked += data.len() as u64; } else { diff --git a/rust/src/frames.rs b/rust/src/frames.rs index 3a45d014b472..022fbc8fa8fc 100644 --- a/rust/src/frames.rs +++ b/rust/src/frames.rs @@ -18,10 +18,10 @@ //! Module for bindings to the Suricata C frame API. use crate::applayer::StreamSlice; +use crate::core::Direction; use crate::core::Flow; #[cfg(not(test))] use crate::core::STREAM_TOSERVER; -use crate::core::Direction; #[cfg(not(test))] #[repr(C)] @@ -62,7 +62,12 @@ impl Frame { frame_type: u8, ) -> Option { let offset = frame_start.as_ptr() as usize - stream_slice.as_slice().as_ptr() as usize; - SCLogDebug!("offset {} stream_slice.len() {} frame_start.len() {}", offset, stream_slice.len(), frame_start.len()); + SCLogDebug!( + "offset {} stream_slice.len() {} frame_start.len() {}", + offset, + stream_slice.len(), + frame_start.len() + ); let frame = unsafe { AppLayerFrameNewByRelativeOffset( flow, diff --git a/rust/src/ftp/event.rs b/rust/src/ftp/event.rs index 04cc9e3f1e3b..594aeee8a9e0 100644 --- a/rust/src/ftp/event.rs +++ b/rust/src/ftp/event.rs @@ -32,7 +32,7 @@ pub enum FtpEvent { /// # Safety /// Unsafe as called from C. #[no_mangle] -pub unsafe extern "C" fn ftp_get_event_info( +pub unsafe extern fn ftp_get_event_info( event_name: *const c_char, event_id: *mut c_int, event_type: *mut AppLayerEventType, ) -> c_int { crate::applayer::get_event_info::(event_name, event_id, event_type) @@ -43,7 +43,7 @@ pub unsafe extern "C" fn ftp_get_event_info( /// # Safety /// Unsafe as called from C. #[no_mangle] -pub unsafe extern "C" fn ftp_get_event_info_by_id( +pub unsafe extern fn ftp_get_event_info_by_id( event_id: c_int, event_name: *mut *const c_char, event_type: *mut AppLayerEventType, ) -> c_int { crate::applayer::get_event_info_by_id::(event_id, event_name, event_type) as c_int diff --git a/rust/src/ftp/mod.rs b/rust/src/ftp/mod.rs index 3839c9661e0d..35324bb49176 100644 --- a/rust/src/ftp/mod.rs +++ b/rust/src/ftp/mod.rs @@ -87,7 +87,7 @@ pub fn ftp_pasv_response(i: &[u8]) -> IResult<&[u8], u16> { } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_active_port(input: *const u8, len: u32) -> u16 { +pub unsafe extern fn rs_ftp_active_port(input: *const u8, len: u32) -> u16 { let buf = build_slice!(input, len as usize); match ftp_active_port(buf) { Ok((_, dport)) => { @@ -104,7 +104,7 @@ pub unsafe extern "C" fn rs_ftp_active_port(input: *const u8, len: u32) -> u16 { } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_pasv_response(input: *const u8, len: u32) -> u16 { +pub unsafe extern fn rs_ftp_pasv_response(input: *const u8, len: u32) -> u16 { let buf = std::slice::from_raw_parts(input, len as usize); match ftp_pasv_response(buf) { Ok((_, dport)) => { @@ -146,7 +146,7 @@ pub fn ftp_active_eprt(i: &[u8]) -> IResult<&[u8], u16> { } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_active_eprt(input: *const u8, len: u32) -> u16 { +pub unsafe extern fn rs_ftp_active_eprt(input: *const u8, len: u32) -> u16 { let buf = build_slice!(input, len as usize); match ftp_active_eprt(buf) { Ok((_, dport)) => { @@ -162,7 +162,7 @@ pub unsafe extern "C" fn rs_ftp_active_eprt(input: *const u8, len: u32) -> u16 { return 0; } #[no_mangle] -pub unsafe extern "C" fn rs_ftp_epsv_response(input: *const u8, len: u32) -> u16 { +pub unsafe extern fn rs_ftp_epsv_response(input: *const u8, len: u32) -> u16 { let buf = std::slice::from_raw_parts(input, len as usize); match ftp_epsv_response(buf) { Ok((_, dport)) => { diff --git a/rust/src/http2/decompression.rs b/rust/src/http2/decompression.rs index 99f8af39032c..31e8547a8134 100644 --- a/rust/src/http2/decompression.rs +++ b/rust/src/http2/decompression.rs @@ -178,10 +178,12 @@ impl HTTP2DecoderHalf { if self.encoding == HTTP2ContentEncoding::Unknown { if input == b"gzip" { self.encoding = HTTP2ContentEncoding::Gzip; - self.decoder = HTTP2Decompresser::Gzip(Box::new(GzDecoder::new(HTTP2cursor::new()))); + self.decoder = + HTTP2Decompresser::Gzip(Box::new(GzDecoder::new(HTTP2cursor::new()))); } else if input == b"deflate" { self.encoding = HTTP2ContentEncoding::Deflate; - self.decoder = HTTP2Decompresser::Deflate(Box::new(DeflateDecoder::new(HTTP2cursor::new()))); + self.decoder = + HTTP2Decompresser::Deflate(Box::new(DeflateDecoder::new(HTTP2cursor::new()))); } else if input == b"br" { self.encoding = HTTP2ContentEncoding::Br; self.decoder = HTTP2Decompresser::Brotli(Box::new(brotli::Decompressor::new( diff --git a/rust/src/http2/detect.rs b/rust/src/http2/detect.rs index 1c595a0cb0f8..44edf83b017e 100644 --- a/rust/src/http2/detect.rs +++ b/rust/src/http2/detect.rs @@ -44,7 +44,7 @@ fn http2_tx_has_frametype( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_has_frametype( +pub unsafe extern fn rs_http2_tx_has_frametype( tx: *mut std::os::raw::c_void, direction: u8, value: u8, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, HTTP2Transaction); @@ -52,7 +52,7 @@ pub unsafe extern "C" fn rs_http2_tx_has_frametype( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_parse_frametype( +pub unsafe extern fn rs_http2_parse_frametype( str: *const std::os::raw::c_char, ) -> std::os::raw::c_int { let ft_name: &CStr = CStr::from_ptr(str); //unsafe @@ -104,7 +104,7 @@ fn http2_tx_has_errorcode( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_has_errorcode( +pub unsafe extern fn rs_http2_tx_has_errorcode( tx: *mut std::os::raw::c_void, direction: u8, code: u32, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, HTTP2Transaction); @@ -112,7 +112,7 @@ pub unsafe extern "C" fn rs_http2_tx_has_errorcode( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_parse_errorcode( +pub unsafe extern fn rs_http2_parse_errorcode( str: *const std::os::raw::c_char, ) -> std::os::raw::c_int { let ft_name: &CStr = CStr::from_ptr(str); //unsafe @@ -177,7 +177,7 @@ fn http2_tx_get_next_priority( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_next_priority( +pub unsafe extern fn rs_http2_tx_get_next_priority( tx: *mut std::os::raw::c_void, direction: u8, nb: u32, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, HTTP2Transaction); @@ -213,7 +213,7 @@ fn http2_tx_get_next_window( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_next_window( +pub unsafe extern fn rs_http2_tx_get_next_window( tx: *mut std::os::raw::c_void, direction: u8, nb: u32, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, HTTP2Transaction); @@ -221,7 +221,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_next_window( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_detect_settingsctx_parse( +pub unsafe extern fn rs_http2_detect_settingsctx_parse( str: *const std::os::raw::c_char, ) -> *mut std::os::raw::c_void { let ft_name: &CStr = CStr::from_ptr(str); //unsafe @@ -235,7 +235,7 @@ pub unsafe extern "C" fn rs_http2_detect_settingsctx_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_detect_settingsctx_free(ctx: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_http2_detect_settingsctx_free(ctx: *mut std::os::raw::c_void) { // Just unbox... std::mem::drop(Box::from_raw(ctx as *mut parser::DetectHTTP2settingsSigCtx)); } @@ -284,7 +284,7 @@ fn http2_detect_settingsctx_match( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_detect_settingsctx_match( +pub unsafe extern fn rs_http2_detect_settingsctx_match( ctx: *const std::os::raw::c_void, tx: *mut std::os::raw::c_void, direction: u8, ) -> std::os::raw::c_int { let ctx = cast_pointer!(ctx, parser::DetectHTTP2settingsSigCtx); @@ -345,7 +345,7 @@ fn http2_detect_sizeupdatectx_match( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_detect_sizeupdatectx_match( +pub unsafe extern fn rs_http2_detect_sizeupdatectx_match( ctx: *const std::os::raw::c_void, tx: *mut std::os::raw::c_void, direction: u8, ) -> std::os::raw::c_int { let ctx = cast_pointer!(ctx, DetectUintData); @@ -356,7 +356,7 @@ pub unsafe extern "C" fn rs_http2_detect_sizeupdatectx_match( //TODOask better syntax between rs_http2_tx_get_header_name in argument // and rs_http2_detect_sizeupdatectx_match explicitly casting #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_header_name( +pub unsafe extern fn rs_http2_tx_get_header_name( tx: &mut HTTP2Transaction, direction: u8, nb: u32, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { let mut pos = 0_u32; @@ -523,7 +523,7 @@ fn http2_tx_get_req_line(tx: &mut HTTP2Transaction) { } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_request_line( +pub unsafe extern fn rs_http2_tx_get_request_line( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { http2_tx_get_req_line(tx); @@ -537,7 +537,7 @@ fn http2_tx_get_resp_line(tx: &mut HTTP2Transaction) { return; } let empty = Vec::new(); - let mut resp_line : Vec = Vec::new(); + let mut resp_line: Vec = Vec::new(); let status = if let Ok(value) = http2_frames_get_header_firstvalue(tx, Direction::ToClient, ":status") { @@ -552,7 +552,7 @@ fn http2_tx_get_resp_line(tx: &mut HTTP2Transaction) { } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_response_line( +pub unsafe extern fn rs_http2_tx_get_response_line( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { http2_tx_get_resp_line(tx); @@ -562,7 +562,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_response_line( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_uri( +pub unsafe extern fn rs_http2_tx_get_uri( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Ok(value) = http2_frames_get_header_firstvalue(tx, Direction::ToServer, ":path") { @@ -574,7 +574,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_uri( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_method( +pub unsafe extern fn rs_http2_tx_get_method( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Ok(value) = http2_frames_get_header_firstvalue(tx, Direction::ToServer, ":method") { @@ -586,7 +586,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_method( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_host( +pub unsafe extern fn rs_http2_tx_get_host( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Ok(value) = http2_frames_get_header_value(tx, Direction::ToServer, ":authority") { @@ -616,7 +616,7 @@ fn http2_lower(value: &[u8]) -> Option> { fn http2_normalize_host(value: &[u8]) -> &[u8] { match value.iter().position(|&x| x == b'@') { Some(i) => { - let value = &value[i+1..]; + let value = &value[i + 1..]; match value.iter().position(|&x| x == b':') { Some(i) => { return &value[..i]; @@ -626,21 +626,19 @@ fn http2_normalize_host(value: &[u8]) -> &[u8] { } } } - None => { - match value.iter().position(|&x| x == b':') { - Some(i) => { - return &value[..i]; - } - None => { - return value; - } + None => match value.iter().position(|&x| x == b':') { + Some(i) => { + return &value[..i]; } - } + None => { + return value; + } + }, } } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_host_norm( +pub unsafe extern fn rs_http2_tx_get_host_norm( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Ok(value) = http2_frames_get_header_value(tx, Direction::ToServer, ":authority") { @@ -669,7 +667,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_host_norm( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_useragent( +pub unsafe extern fn rs_http2_tx_get_useragent( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Ok(value) = http2_frames_get_header_value(tx, Direction::ToServer, "user-agent") { @@ -681,7 +679,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_useragent( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_status( +pub unsafe extern fn rs_http2_tx_get_status( tx: &mut HTTP2Transaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Ok(value) = http2_frames_get_header_firstvalue(tx, Direction::ToClient, ":status") { @@ -693,7 +691,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_status( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_cookie( +pub unsafe extern fn rs_http2_tx_get_cookie( tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if direction == Direction::ToServer.into() { @@ -711,7 +709,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_cookie( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_header_value( +pub unsafe extern fn rs_http2_tx_get_header_value( tx: &mut HTTP2Transaction, direction: u8, strname: *const std::os::raw::c_char, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { @@ -737,7 +735,7 @@ fn http2_escape_header(blocks: &[parser::HTTP2FrameHeaderBlock], i: u32) -> Vec< } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_header_names( +pub unsafe extern fn rs_http2_tx_get_header_names( tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { let mut vec = vec![b'\r', b'\n']; @@ -801,7 +799,7 @@ fn http2_header_trimspaces(value: &[u8]) -> &[u8] { } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_headers( +pub unsafe extern fn rs_http2_tx_get_headers( tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { let mut vec = Vec::new(); @@ -835,7 +833,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_headers( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_headers_raw( +pub unsafe extern fn rs_http2_tx_get_headers_raw( tx: &mut HTTP2Transaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { let mut vec = Vec::new(); @@ -867,7 +865,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_headers_raw( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_header( +pub unsafe extern fn rs_http2_tx_get_header( tx: &mut HTTP2Transaction, direction: u8, nb: u32, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { let mut pos = 0_u32; @@ -942,7 +940,7 @@ fn http2_tx_set_header(state: &mut HTTP2State, name: &[u8], input: &[u8]) { } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_set_method( +pub unsafe extern fn rs_http2_tx_set_method( state: &mut HTTP2State, buffer: *const u8, buffer_len: u32, ) { let slice = build_slice!(buffer, buffer_len as usize); @@ -950,7 +948,7 @@ pub unsafe extern "C" fn rs_http2_tx_set_method( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_set_uri( +pub unsafe extern fn rs_http2_tx_set_uri( state: &mut HTTP2State, buffer: *const u8, buffer_len: u32, ) { let slice = build_slice!(buffer, buffer_len as usize); @@ -1000,7 +998,7 @@ fn http2_caseinsensitive_cmp(s1: &[u8], s2: &str) -> bool { } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_add_header( +pub unsafe extern fn rs_http2_tx_add_header( state: &mut HTTP2State, name: *const u8, name_len: u32, value: *const u8, value_len: u32, ) { let slice_name = build_slice!(name, name_len as usize); diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index 14d7b47dfb03..4ab78ad1eb5a 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -41,7 +41,7 @@ const HTTP2_MIN_HANDLED_FRAME_SIZE: usize = 256; pub static mut SURICATA_HTTP2_FILE_CONFIG: Option<&'static SuricataFileContext> = None; #[no_mangle] -pub extern "C" fn rs_http2_init(context: &'static mut SuricataFileContext) { +pub extern fn rs_http2_init(context: &'static mut SuricataFileContext) { unsafe { SURICATA_HTTP2_FILE_CONFIG = Some(context); } @@ -184,13 +184,13 @@ impl HTTP2Transaction { if let Some(sfcm) = unsafe { SURICATA_HTTP2_FILE_CONFIG } { //TODO get a file container instead of NULL (c.HTPFileCloseHandleRange)( - sfcm.files_sbcfg, - std::ptr::null_mut(), - 0, - self.file_range, - std::ptr::null_mut(), - 0, - ); + sfcm.files_sbcfg, + std::ptr::null_mut(), + 0, + self.file_range, + std::ptr::null_mut(), + 0, + ); (c.HttpRangeFreeBlock)(self.file_range); self.file_range = std::ptr::null_mut(); } @@ -237,7 +237,8 @@ impl HTTP2Transaction { } fn decompress<'a>( - &'a mut self, input: &'a [u8], dir: Direction, sfcm: &'static SuricataFileContext, over: bool, flow: *const Flow, + &'a mut self, input: &'a [u8], dir: Direction, sfcm: &'static SuricataFileContext, + over: bool, flow: *const Flow, ) -> io::Result<()> { let mut output = Vec::with_capacity(decompression::HTTP2_DECOMPRESSION_CHUNK_SIZE); let decompressed = self.decoder.decompress(input, &mut output, dir)?; @@ -256,7 +257,14 @@ impl HTTP2Transaction { ) { match range::http2_parse_check_content_range(&value) { Ok((_, v)) => { - range::http2_range_open(self, &v, flow, sfcm, Direction::ToClient, decompressed); + range::http2_range_open( + self, + &v, + flow, + sfcm, + Direction::ToClient, + decompressed, + ); if over && !self.file_range.is_null() { range::http2_range_close(self, Direction::ToClient, &[]) } @@ -589,7 +597,7 @@ impl HTTP2State { tx.state = HTTP2TransactionState::HTTP2StateGlobal; tx.tx_data.update_file_flags(self.state_data.file_flags); // TODO can this tx hold files? - tx.tx_data.file_tx = STREAM_TOSERVER|STREAM_TOCLIENT; // might hold files in both directions + tx.tx_data.file_tx = STREAM_TOSERVER | STREAM_TOCLIENT; // might hold files in both directions tx.update_file_flags(tx.tx_data.file_flags); self.transactions.push_back(tx); return self.transactions.back_mut().unwrap(); @@ -650,7 +658,7 @@ impl HTTP2State { } tx.tx_data.update_file_flags(self.state_data.file_flags); tx.update_file_flags(tx.tx_data.file_flags); - tx.tx_data.file_tx = STREAM_TOSERVER|STREAM_TOCLIENT; // might hold files in both directions + tx.tx_data.file_tx = STREAM_TOSERVER | STREAM_TOCLIENT; // might hold files in both directions self.transactions.push_back(tx); return self.transactions.back_mut().unwrap(); } @@ -661,9 +669,7 @@ impl HTTP2State { for block in blocks { if block.error >= parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeError { self.set_event(HTTP2Event::InvalidHeader); - } else if block.error - == parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeSizeUpdate - { + } else if block.error == parser::HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeSizeUpdate { update = true; if block.sizeupdate > sizeup { sizeup = block.sizeupdate; @@ -999,15 +1005,10 @@ impl HTTP2State { tx_same.ft_ts.tx_id = tx_same.tx_id - 1; }; let mut dinput = &rem[..hlsafe]; - if padded && !rem.is_empty() && usize::from(rem[0]) < hlsafe{ + if padded && !rem.is_empty() && usize::from(rem[0]) < hlsafe { dinput = &rem[1..hlsafe - usize::from(rem[0])]; } - if tx_same.decompress( - dinput, - dir, - sfcm, - over, - flow).is_err() { + if tx_same.decompress(dinput, dir, sfcm, over, flow).is_err() { self.set_event(HTTP2Event::FailedDecompression); } } @@ -1108,7 +1109,7 @@ export_state_data_get!(rs_http2_get_state_data, HTTP2State); /// C entry point for a probing parser. #[no_mangle] -pub unsafe extern "C" fn rs_http2_probing_parser_tc( +pub unsafe extern fn rs_http2_probing_parser_tc( _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { if !input.is_null() { @@ -1136,7 +1137,7 @@ pub unsafe extern "C" fn rs_http2_probing_parser_tc( } // Extern functions operating on HTTP2. -extern "C" { +extern { pub fn HTTP2MimicHttp1Request( orig_state: *mut std::os::raw::c_void, new_state: *mut std::os::raw::c_void, ); @@ -1146,7 +1147,7 @@ extern "C" { // is typically not unsafe. #[no_mangle] #[allow(clippy::not_unsafe_ptr_arg_deref)] -pub extern "C" fn rs_http2_state_new( +pub extern fn rs_http2_state_new( orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = HTTP2State::new(); @@ -1162,19 +1163,19 @@ pub extern "C" fn rs_http2_state_new( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_state_free(state: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_http2_state_free(state: *mut std::os::raw::c_void) { let mut state: Box = Box::from_raw(state as _); state.free(); } #[no_mangle] -pub unsafe extern "C" fn rs_http2_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_http2_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, HTTP2State); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_http2_parse_ts( +pub unsafe extern fn rs_http2_parse_ts( flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -1184,7 +1185,7 @@ pub unsafe extern "C" fn rs_http2_parse_ts( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_parse_tc( +pub unsafe extern fn rs_http2_parse_tc( flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -1194,7 +1195,7 @@ pub unsafe extern "C" fn rs_http2_parse_tc( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_state_get_tx( +pub unsafe extern fn rs_http2_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, HTTP2State); @@ -1209,37 +1210,40 @@ pub unsafe extern "C" fn rs_http2_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_http2_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_http2_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, HTTP2State); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_state( - tx: *mut std::os::raw::c_void, -) -> HTTP2TransactionState { +pub unsafe extern fn rs_http2_tx_get_state(tx: *mut std::os::raw::c_void) -> HTTP2TransactionState { let tx = cast_pointer!(tx, HTTP2Transaction); return tx.state; } #[no_mangle] -pub unsafe extern "C" fn rs_http2_tx_get_alstate_progress( +pub unsafe extern fn rs_http2_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { return rs_http2_tx_get_state(tx) as i32; } #[no_mangle] -pub unsafe extern "C" fn rs_http2_getfiles( - _state: *mut std::os::raw::c_void, - tx: *mut std::os::raw::c_void, direction: u8, +pub unsafe extern fn rs_http2_getfiles( + _state: *mut std::os::raw::c_void, tx: *mut std::os::raw::c_void, direction: u8, ) -> AppLayerGetFileState { let tx = cast_pointer!(tx, HTTP2Transaction); if let Some(sfcm) = { SURICATA_HTTP2_FILE_CONFIG } { if direction & STREAM_TOSERVER != 0 { - return AppLayerGetFileState { fc: &mut tx.ft_ts.file, cfg: sfcm.files_sbcfg } + return AppLayerGetFileState { + fc: &mut tx.ft_ts.file, + cfg: sfcm.files_sbcfg, + }; } else { - return AppLayerGetFileState { fc: &mut tx.ft_tc.file, cfg: sfcm.files_sbcfg } + return AppLayerGetFileState { + fc: &mut tx.ft_tc.file, + cfg: sfcm.files_sbcfg, + }; } } AppLayerGetFileState::err() @@ -1249,7 +1253,7 @@ pub unsafe extern "C" fn rs_http2_getfiles( const PARSER_NAME: &[u8] = b"http2\0"; #[no_mangle] -pub unsafe extern "C" fn rs_http2_register_parser() { +pub unsafe extern fn rs_http2_register_parser() { let default_port = CString::new("[80]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, diff --git a/rust/src/http2/logger.rs b/rust/src/http2/logger.rs index 099112b1aeb4..9b0e1ee5e975 100644 --- a/rust/src/http2/logger.rs +++ b/rust/src/http2/logger.rs @@ -112,7 +112,10 @@ fn log_http2_frames(frames: &[HTTP2Frame], js: &mut JsonBuilder) -> Result Result bool { let tx = cast_pointer!(tx, HTTP2Transaction); diff --git a/rust/src/http2/parser.rs b/rust/src/http2/parser.rs index adabeb28c6e4..5a060bd1b2c3 100644 --- a/rust/src/http2/parser.rs +++ b/rust/src/http2/parser.rs @@ -460,8 +460,9 @@ fn http2_parse_headers_block_literal_incindex<'a>( while dyn_headers.current_size > dyn_headers.max_size && toremove < dyn_headers.table.len() { - dyn_headers.current_size -= - 32 + dyn_headers.table[toremove].name.len() + dyn_headers.table[toremove].value.len(); + dyn_headers.current_size -= 32 + + dyn_headers.table[toremove].name.len() + + dyn_headers.table[toremove].value.len(); toremove += 1; } dyn_headers.table.drain(0..toremove); diff --git a/rust/src/http2/range.rs b/rust/src/http2/range.rs index 9c96899443a1..df9dc816c2dc 100644 --- a/rust/src/http2/range.rs +++ b/rust/src/http2/range.rs @@ -84,7 +84,7 @@ pub fn http2_parse_check_content_range(input: &[u8]) -> IResult<&[u8], HTTPConte } #[no_mangle] -pub unsafe extern "C" fn rs_http_parse_content_range( +pub unsafe extern fn rs_http_parse_content_range( cr: &mut HTTPContentRange, buffer: *const u8, buffer_len: u32, ) -> std::os::raw::c_int { let slice = build_slice!(buffer, buffer_len as usize); @@ -131,7 +131,11 @@ pub fn http2_range_open( // whole file in one range return; } - let flags = if dir == Direction::ToServer { tx.ft_ts.file_flags } else { tx.ft_tc.file_flags }; + let flags = if dir == Direction::ToServer { + tx.ft_ts.file_flags + } else { + tx.ft_tc.file_flags + }; if let Ok((key, index)) = http2_range_key_get(tx) { let name = &key[index..]; tx.file_range = unsafe { @@ -151,15 +155,15 @@ pub fn http2_range_open( } } -pub fn http2_range_append(cfg: &'static SuricataFileContext, fr: *mut HttpRangeContainerBlock, data: &[u8]) { +pub fn http2_range_append( + cfg: &'static SuricataFileContext, fr: *mut HttpRangeContainerBlock, data: &[u8], +) { unsafe { HttpRangeAppendData(cfg.files_sbcfg, fr, data.as_ptr(), data.len() as u32); } } -pub fn http2_range_close( - tx: &mut HTTP2Transaction, dir: Direction, data: &[u8], -) { +pub fn http2_range_close(tx: &mut HTTP2Transaction, dir: Direction, data: &[u8]) { let added = if let Some(c) = unsafe { SC } { if let Some(sfcm) = unsafe { SURICATA_HTTP2_FILE_CONFIG } { let (files, flags) = if dir == Direction::ToServer { @@ -168,13 +172,13 @@ pub fn http2_range_close( (&mut tx.ft_tc.file, tx.ft_tc.file_flags) }; let added = (c.HTPFileCloseHandleRange)( - sfcm.files_sbcfg, - files, - flags, - tx.file_range, - data.as_ptr(), - data.len() as u32, - ); + sfcm.files_sbcfg, + files, + flags, + tx.file_range, + data.as_ptr(), + data.len() as u32, + ); (c.HttpRangeFreeBlock)(tx.file_range); added } else { @@ -190,14 +194,15 @@ pub fn http2_range_close( } // Defined in app-layer-htp-range.h -extern "C" { +extern { pub fn HttpRangeContainerOpenFile( key: *const c_uchar, keylen: u32, f: *const Flow, cr: &HTTPContentRange, sbcfg: *const StreamingBufferConfig, name: *const c_uchar, name_len: u16, flags: u16, data: *const c_uchar, data_len: u32, ) -> *mut HttpRangeContainerBlock; pub fn HttpRangeAppendData( - cfg: *const StreamingBufferConfig, c: *mut HttpRangeContainerBlock, data: *const c_uchar, data_len: u32, + cfg: *const StreamingBufferConfig, c: *mut HttpRangeContainerBlock, data: *const c_uchar, + data_len: u32, ) -> std::os::raw::c_int; } diff --git a/rust/src/ike/detect.rs b/rust/src/ike/detect.rs index 64d27a462afb..1701e7807be4 100644 --- a/rust/src/ike/detect.rs +++ b/rust/src/ike/detect.rs @@ -23,7 +23,7 @@ use std::ffi::CStr; use std::ptr; #[no_mangle] -pub extern "C" fn rs_ike_state_get_exch_type(tx: &mut IKETransaction, exch_type: *mut u8) -> u8 { +pub extern fn rs_ike_state_get_exch_type(tx: &mut IKETransaction, exch_type: *mut u8) -> u8 { debug_validate_bug_on!(exch_type.is_null()); if tx.ike_version == 1 { @@ -44,7 +44,7 @@ pub extern "C" fn rs_ike_state_get_exch_type(tx: &mut IKETransaction, exch_type: } #[no_mangle] -pub extern "C" fn rs_ike_state_get_spi_initiator( +pub extern fn rs_ike_state_get_spi_initiator( tx: &mut IKETransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { debug_validate_bug_on!(buffer.is_null() || buffer_len.is_null()); @@ -57,7 +57,7 @@ pub extern "C" fn rs_ike_state_get_spi_initiator( } #[no_mangle] -pub extern "C" fn rs_ike_state_get_spi_responder( +pub extern fn rs_ike_state_get_spi_responder( tx: &mut IKETransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { debug_validate_bug_on!(buffer.is_null() || buffer_len.is_null()); @@ -70,7 +70,7 @@ pub extern "C" fn rs_ike_state_get_spi_responder( } #[no_mangle] -pub extern "C" fn rs_ike_state_get_nonce( +pub extern fn rs_ike_state_get_nonce( tx: &mut IKETransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { debug_validate_bug_on!(buffer.is_null() || buffer_len.is_null()); @@ -93,7 +93,7 @@ pub extern "C" fn rs_ike_state_get_nonce( } #[no_mangle] -pub extern "C" fn rs_ike_state_get_key_exchange( +pub extern fn rs_ike_state_get_key_exchange( tx: &mut IKETransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { debug_validate_bug_on!(buffer.is_null() || buffer_len.is_null()); @@ -116,7 +116,7 @@ pub extern "C" fn rs_ike_state_get_key_exchange( } #[no_mangle] -pub extern "C" fn rs_ike_tx_get_vendor( +pub extern fn rs_ike_tx_get_vendor( tx: &IKETransaction, i: u32, buf: *mut *const u8, len: *mut u32, ) -> u8 { if tx.ike_version == 1 && i < tx.hdr.ikev1_header.vendor_ids.len() as u32 { @@ -136,7 +136,7 @@ pub extern "C" fn rs_ike_tx_get_vendor( } #[no_mangle] -pub extern "C" fn rs_ike_state_get_sa_attribute( +pub extern fn rs_ike_state_get_sa_attribute( tx: &mut IKETransaction, sa_type: *const std::os::raw::c_char, value: *mut u32, ) -> u8 { debug_validate_bug_on!(value.is_null()); @@ -207,7 +207,7 @@ pub extern "C" fn rs_ike_state_get_sa_attribute( } #[no_mangle] -pub unsafe extern "C" fn rs_ike_state_get_key_exchange_payload_length( +pub unsafe extern fn rs_ike_state_get_key_exchange_payload_length( tx: &mut IKETransaction, value: *mut u32, ) -> u8 { debug_validate_bug_on!(value.is_null()); @@ -222,7 +222,7 @@ pub unsafe extern "C" fn rs_ike_state_get_key_exchange_payload_length( } #[no_mangle] -pub unsafe extern "C" fn rs_ike_state_get_nonce_payload_length( +pub unsafe extern fn rs_ike_state_get_nonce_payload_length( tx: &mut IKETransaction, value: *mut u32, ) -> u8 { debug_validate_bug_on!(value.is_null()); diff --git a/rust/src/ike/ike.rs b/rust/src/ike/ike.rs index 2a5448ab27cf..a0d5a5ffecb4 100644 --- a/rust/src/ike/ike.rs +++ b/rust/src/ike/ike.rs @@ -124,11 +124,11 @@ impl Transaction for IKETransaction { impl IKETransaction { pub fn new(direction: Direction) -> Self { - Self { - direction, - tx_data: applayer::AppLayerTxData::for_direction(direction), - ..Default::default() - } + Self { + direction, + tx_data: applayer::AppLayerTxData::for_direction(direction), + ..Default::default() + } } /// Set an event. @@ -171,7 +171,9 @@ impl IKEState { } pub fn get_tx(&mut self, tx_id: u64) -> Option<&mut IKETransaction> { - self.transactions.iter_mut().find(|tx| tx.tx_id == tx_id + 1) + self.transactions + .iter_mut() + .find(|tx| tx.tx_id == tx_id + 1) } pub fn new_tx(&mut self, direction: Direction) -> IKETransaction { @@ -278,7 +280,7 @@ fn probe(input: &[u8], direction: Direction, rdir: *mut u8) -> bool { /// C entry point for a probing parser. #[no_mangle] -pub unsafe extern "C" fn rs_ike_probing_parser( +pub unsafe extern fn rs_ike_probing_parser( _flow: *const Flow, direction: u8, input: *const u8, input_len: u32, rdir: *mut u8, ) -> AppProto { if input_len < 28 { @@ -296,7 +298,7 @@ pub unsafe extern "C" fn rs_ike_probing_parser( } #[no_mangle] -pub extern "C" fn rs_ike_state_new( +pub extern fn rs_ike_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = IKEState::default(); @@ -305,19 +307,19 @@ pub extern "C" fn rs_ike_state_new( } #[no_mangle] -pub unsafe extern "C" fn rs_ike_state_free(state: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_ike_state_free(state: *mut std::os::raw::c_void) { // Just unbox... std::mem::drop(Box::from_raw(state as *mut IKEState)); } #[no_mangle] -pub unsafe extern "C" fn rs_ike_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_ike_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, IKEState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_ike_parse_request( +pub unsafe extern fn rs_ike_parse_request( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -326,7 +328,7 @@ pub unsafe extern "C" fn rs_ike_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_ike_parse_response( +pub unsafe extern fn rs_ike_parse_response( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -335,7 +337,7 @@ pub unsafe extern "C" fn rs_ike_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_ike_state_get_tx( +pub unsafe extern fn rs_ike_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, IKEState); @@ -350,26 +352,26 @@ pub unsafe extern "C" fn rs_ike_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_ike_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_ike_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, IKEState); return state.tx_id; } #[no_mangle] -pub extern "C" fn rs_ike_state_progress_completion_status(_direction: u8) -> std::os::raw::c_int { +pub extern fn rs_ike_state_progress_completion_status(_direction: u8) -> std::os::raw::c_int { // This parser uses 1 to signal transaction completion status. return 1; } #[no_mangle] -pub extern "C" fn rs_ike_tx_get_alstate_progress( +pub extern fn rs_ike_tx_get_alstate_progress( _tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { return 1; } #[no_mangle] -pub unsafe extern "C" fn rs_ike_tx_get_logged( +pub unsafe extern fn rs_ike_tx_get_logged( _state: *mut std::os::raw::c_void, tx: *mut std::os::raw::c_void, ) -> u32 { let tx = cast_pointer!(tx, IKETransaction); @@ -377,7 +379,7 @@ pub unsafe extern "C" fn rs_ike_tx_get_logged( } #[no_mangle] -pub unsafe extern "C" fn rs_ike_tx_set_logged( +pub unsafe extern fn rs_ike_tx_set_logged( _state: *mut std::os::raw::c_void, tx: *mut std::os::raw::c_void, logged: u32, ) { let tx = cast_pointer!(tx, IKETransaction); @@ -394,7 +396,7 @@ export_tx_data_get!(rs_ike_get_tx_data, IKETransaction); export_state_data_get!(rs_ike_get_state_data, IKEState); #[no_mangle] -pub unsafe extern "C" fn rs_ike_register_parser() { +pub unsafe extern fn rs_ike_register_parser() { let default_port = CString::new("500").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, diff --git a/rust/src/ike/ikev1.rs b/rust/src/ike/ikev1.rs index 1e79c293cdea..7996b8dd053c 100644 --- a/rust/src/ike/ikev1.rs +++ b/rust/src/ike/ikev1.rs @@ -52,9 +52,7 @@ impl Ikev1ParticipantData { self.transform.clear(); } - pub fn update( - &mut self, key_exchange: &str, nonce: &str, transforms: &Vec>, - ) { + pub fn update(&mut self, key_exchange: &str, nonce: &str, transforms: &Vec>) { self.key_exchange = key_exchange.to_string(); self.nonce = nonce.to_string(); if self.nb_transforms == 0 && !transforms.is_empty() { @@ -103,7 +101,9 @@ pub fn handle_ikev1( &mut tx.hdr.ikev1_transforms, &mut tx.hdr.ikev1_header.vendor_ids, &mut payload_types, - ).is_err() { + ) + .is_err() + { SCLogDebug!("Error while parsing IKEV1 payloads"); return AppLayerResult::err(); } diff --git a/rust/src/ike/ikev2.rs b/rust/src/ike/ikev2.rs index a1be25ffb4a2..51895d25923d 100644 --- a/rust/src/ike/ikev2.rs +++ b/rust/src/ike/ikev2.rs @@ -276,9 +276,9 @@ fn add_proposals( IkeV2Transform::Auth(_) => true, _ => false, }) && !transforms.iter().any(|x| match *x { - IkeV2Transform::Encryption(ref enc) => enc.is_aead(), - _ => false, - }) { + IkeV2Transform::Encryption(ref enc) => enc.is_aead(), + _ => false, + }) { SCLogDebug!("No integrity transform found"); tx.set_event(IkeEvent::WeakCryptoNoAuth); } diff --git a/rust/src/ike/logger.rs b/rust/src/ike/logger.rs index cc5705f5808e..68057065c709 100644 --- a/rust/src/ike/logger.rs +++ b/rust/src/ike/logger.rs @@ -226,7 +226,7 @@ fn log_ikev2(tx: &IKETransaction, jb: &mut JsonBuilder) -> Result<(), JsonError> } #[no_mangle] -pub unsafe extern "C" fn rs_ike_logger_log( +pub unsafe extern fn rs_ike_logger_log( state: &mut IKEState, tx: *mut std::os::raw::c_void, flags: u32, js: &mut JsonBuilder, ) -> bool { let tx = cast_pointer!(tx, IKETransaction); diff --git a/rust/src/ike/parser.rs b/rust/src/ike/parser.rs index dcc574534290..08e97324d8ca 100644 --- a/rust/src/ike/parser.rs +++ b/rust/src/ike/parser.rs @@ -470,8 +470,7 @@ pub fn parse_sa_attribute(i: &[u8]) -> IResult<&[u8], Vec> { _ => None, }, hex_value: match format.0 { - 0 => variable_attribute_value - .map(to_hex), + 0 => variable_attribute_value.map(to_hex), _ => None, }, }; @@ -556,7 +555,9 @@ pub fn parse_payload( transforms, vendor_ids, payload_types, - ).is_err() { + ) + .is_err() + { SCLogDebug!("Error parsing SecurityAssociation"); return Err(()); } @@ -572,7 +573,9 @@ pub fn parse_payload( transforms, vendor_ids, payload_types, - ).is_err() { + ) + .is_err() + { SCLogDebug!("Error parsing Proposal"); return Err(()); } @@ -632,7 +635,9 @@ fn parse_proposal_payload( transforms, vendor_ids, payload_types, - ).is_err() { + ) + .is_err() + { SCLogDebug!("Error parsing transform payload"); return Err(()); } @@ -683,7 +688,9 @@ fn parse_security_association_payload( transforms, vendor_ids, payload_types, - ).is_err() { + ) + .is_err() + { SCLogDebug!("Error parsing proposal payload"); return Err(()); } diff --git a/rust/src/jsonbuilder.rs b/rust/src/jsonbuilder.rs index 82be09953c70..27fe6a8f9797 100644 --- a/rust/src/jsonbuilder.rs +++ b/rust/src/jsonbuilder.rs @@ -15,7 +15,7 @@ * 02110-1301, USA. */ - //! Module for building JSON documents. +//! Module for building JSON documents. #![allow(clippy::missing_safety_doc)] @@ -744,7 +744,7 @@ fn try_string_from_bytes(input: &[u8]) -> Result { } #[no_mangle] -pub extern "C" fn jb_new_object() -> *mut JsonBuilder { +pub extern fn jb_new_object() -> *mut JsonBuilder { match JsonBuilder::try_new_object() { Ok(js) => { let boxed = Box::new(js); @@ -755,7 +755,7 @@ pub extern "C" fn jb_new_object() -> *mut JsonBuilder { } #[no_mangle] -pub extern "C" fn jb_new_array() -> *mut JsonBuilder { +pub extern fn jb_new_array() -> *mut JsonBuilder { match JsonBuilder::try_new_array() { Ok(js) => { let boxed = Box::new(js); @@ -766,28 +766,28 @@ pub extern "C" fn jb_new_array() -> *mut JsonBuilder { } #[no_mangle] -pub extern "C" fn jb_clone(js: &mut JsonBuilder) -> *mut JsonBuilder { +pub extern fn jb_clone(js: &mut JsonBuilder) -> *mut JsonBuilder { let clone = Box::new(js.clone()); Box::into_raw(clone) } #[no_mangle] -pub unsafe extern "C" fn jb_free(js: &mut JsonBuilder) { +pub unsafe extern fn jb_free(js: &mut JsonBuilder) { let _ = Box::from_raw(js); } #[no_mangle] -pub extern "C" fn jb_capacity(jb: &mut JsonBuilder) -> usize { +pub extern fn jb_capacity(jb: &mut JsonBuilder) -> usize { jb.capacity() } #[no_mangle] -pub extern "C" fn jb_reset(jb: &mut JsonBuilder) { +pub extern fn jb_reset(jb: &mut JsonBuilder) { jb.reset(); } #[no_mangle] -pub unsafe extern "C" fn jb_open_object(js: &mut JsonBuilder, key: *const c_char) -> bool { +pub unsafe extern fn jb_open_object(js: &mut JsonBuilder, key: *const c_char) -> bool { if let Ok(s) = CStr::from_ptr(key).to_str() { js.open_object(s).is_ok() } else { @@ -796,12 +796,12 @@ pub unsafe extern "C" fn jb_open_object(js: &mut JsonBuilder, key: *const c_char } #[no_mangle] -pub unsafe extern "C" fn jb_start_object(js: &mut JsonBuilder) -> bool { +pub unsafe extern fn jb_start_object(js: &mut JsonBuilder) -> bool { js.start_object().is_ok() } #[no_mangle] -pub unsafe extern "C" fn jb_open_array(js: &mut JsonBuilder, key: *const c_char) -> bool { +pub unsafe extern fn jb_open_array(js: &mut JsonBuilder, key: *const c_char) -> bool { if let Ok(s) = CStr::from_ptr(key).to_str() { js.open_array(s).is_ok() } else { @@ -810,7 +810,7 @@ pub unsafe extern "C" fn jb_open_array(js: &mut JsonBuilder, key: *const c_char) } #[no_mangle] -pub unsafe extern "C" fn jb_set_string( +pub unsafe extern fn jb_set_string( js: &mut JsonBuilder, key: *const c_char, val: *const c_char, ) -> bool { if val.is_null() { @@ -825,7 +825,7 @@ pub unsafe extern "C" fn jb_set_string( } #[no_mangle] -pub unsafe extern "C" fn jb_set_string_from_bytes( +pub unsafe extern fn jb_set_string_from_bytes( js: &mut JsonBuilder, key: *const c_char, bytes: *const u8, len: u32, ) -> bool { if bytes.is_null() || len == 0 { @@ -839,7 +839,7 @@ pub unsafe extern "C" fn jb_set_string_from_bytes( } #[no_mangle] -pub unsafe extern "C" fn jb_set_base64( +pub unsafe extern fn jb_set_base64( js: &mut JsonBuilder, key: *const c_char, bytes: *const u8, len: u32, ) -> bool { if bytes.is_null() || len == 0 { @@ -853,7 +853,7 @@ pub unsafe extern "C" fn jb_set_base64( } #[no_mangle] -pub unsafe extern "C" fn jb_set_hex( +pub unsafe extern fn jb_set_hex( js: &mut JsonBuilder, key: *const c_char, bytes: *const u8, len: u32, ) -> bool { if bytes.is_null() || len == 0 { @@ -867,7 +867,7 @@ pub unsafe extern "C" fn jb_set_hex( } #[no_mangle] -pub unsafe extern "C" fn jb_set_formatted(js: &mut JsonBuilder, formatted: *const c_char) -> bool { +pub unsafe extern fn jb_set_formatted(js: &mut JsonBuilder, formatted: *const c_char) -> bool { if let Ok(formatted) = CStr::from_ptr(formatted).to_str() { return js.set_formatted(formatted).is_ok(); } @@ -875,12 +875,12 @@ pub unsafe extern "C" fn jb_set_formatted(js: &mut JsonBuilder, formatted: *cons } #[no_mangle] -pub unsafe extern "C" fn jb_append_object(jb: &mut JsonBuilder, obj: &JsonBuilder) -> bool { +pub unsafe extern fn jb_append_object(jb: &mut JsonBuilder, obj: &JsonBuilder) -> bool { jb.append_object(obj).is_ok() } #[no_mangle] -pub unsafe extern "C" fn jb_set_object( +pub unsafe extern fn jb_set_object( js: &mut JsonBuilder, key: *const c_char, val: &mut JsonBuilder, ) -> bool { if let Ok(key) = CStr::from_ptr(key).to_str() { @@ -890,7 +890,7 @@ pub unsafe extern "C" fn jb_set_object( } #[no_mangle] -pub unsafe extern "C" fn jb_append_string(js: &mut JsonBuilder, val: *const c_char) -> bool { +pub unsafe extern fn jb_append_string(js: &mut JsonBuilder, val: *const c_char) -> bool { if val.is_null() { return false; } @@ -901,7 +901,7 @@ pub unsafe extern "C" fn jb_append_string(js: &mut JsonBuilder, val: *const c_ch } #[no_mangle] -pub unsafe extern "C" fn jb_append_string_from_bytes( +pub unsafe extern fn jb_append_string_from_bytes( js: &mut JsonBuilder, bytes: *const u8, len: u32, ) -> bool { if bytes.is_null() || len == 0 { @@ -912,9 +912,7 @@ pub unsafe extern "C" fn jb_append_string_from_bytes( } #[no_mangle] -pub unsafe extern "C" fn jb_append_base64( - js: &mut JsonBuilder, bytes: *const u8, len: u32, -) -> bool { +pub unsafe extern fn jb_append_base64(js: &mut JsonBuilder, bytes: *const u8, len: u32) -> bool { if bytes.is_null() || len == 0 { return false; } @@ -923,17 +921,17 @@ pub unsafe extern "C" fn jb_append_base64( } #[no_mangle] -pub unsafe extern "C" fn jb_append_uint(js: &mut JsonBuilder, val: u64) -> bool { +pub unsafe extern fn jb_append_uint(js: &mut JsonBuilder, val: u64) -> bool { return js.append_uint(val).is_ok(); } #[no_mangle] -pub unsafe extern "C" fn jb_append_float(js: &mut JsonBuilder, val: f64) -> bool { +pub unsafe extern fn jb_append_float(js: &mut JsonBuilder, val: f64) -> bool { return js.append_float(val).is_ok(); } #[no_mangle] -pub unsafe extern "C" fn jb_set_uint(js: &mut JsonBuilder, key: *const c_char, val: u64) -> bool { +pub unsafe extern fn jb_set_uint(js: &mut JsonBuilder, key: *const c_char, val: u64) -> bool { if let Ok(key) = CStr::from_ptr(key).to_str() { return js.set_uint(key, val).is_ok(); } @@ -941,7 +939,7 @@ pub unsafe extern "C" fn jb_set_uint(js: &mut JsonBuilder, key: *const c_char, v } #[no_mangle] -pub unsafe extern "C" fn jb_set_float(js: &mut JsonBuilder, key: *const c_char, val: f64) -> bool { +pub unsafe extern fn jb_set_float(js: &mut JsonBuilder, key: *const c_char, val: f64) -> bool { if let Ok(key) = CStr::from_ptr(key).to_str() { return js.set_float(key, val).is_ok(); } @@ -949,7 +947,7 @@ pub unsafe extern "C" fn jb_set_float(js: &mut JsonBuilder, key: *const c_char, } #[no_mangle] -pub unsafe extern "C" fn jb_set_bool(js: &mut JsonBuilder, key: *const c_char, val: bool) -> bool { +pub unsafe extern fn jb_set_bool(js: &mut JsonBuilder, key: *const c_char, val: bool) -> bool { if let Ok(key) = CStr::from_ptr(key).to_str() { return js.set_bool(key, val).is_ok(); } @@ -957,22 +955,22 @@ pub unsafe extern "C" fn jb_set_bool(js: &mut JsonBuilder, key: *const c_char, v } #[no_mangle] -pub unsafe extern "C" fn jb_close(js: &mut JsonBuilder) -> bool { +pub unsafe extern fn jb_close(js: &mut JsonBuilder) -> bool { js.close().is_ok() } #[no_mangle] -pub unsafe extern "C" fn jb_len(js: &JsonBuilder) -> usize { +pub unsafe extern fn jb_len(js: &JsonBuilder) -> usize { js.buf.len() } #[no_mangle] -pub unsafe extern "C" fn jb_ptr(js: &mut JsonBuilder) -> *const u8 { +pub unsafe extern fn jb_ptr(js: &mut JsonBuilder) -> *const u8 { js.buf.as_ptr() } #[no_mangle] -pub unsafe extern "C" fn jb_get_mark(js: &mut JsonBuilder, mark: &mut JsonBuilderMark) { +pub unsafe extern fn jb_get_mark(js: &mut JsonBuilder, mark: &mut JsonBuilderMark) { let m = js.get_mark(); mark.position = m.position; mark.state_index = m.state_index; @@ -980,7 +978,7 @@ pub unsafe extern "C" fn jb_get_mark(js: &mut JsonBuilder, mark: &mut JsonBuilde } #[no_mangle] -pub unsafe extern "C" fn jb_restore_mark(js: &mut JsonBuilder, mark: &mut JsonBuilderMark) -> bool { +pub unsafe extern fn jb_restore_mark(js: &mut JsonBuilder, mark: &mut JsonBuilderMark) -> bool { js.restore_mark(mark).is_ok() } diff --git a/rust/src/kerberos.rs b/rust/src/kerberos.rs index e7c51cc2f28f..0fef1ec256c6 100644 --- a/rust/src/kerberos.rs +++ b/rust/src/kerberos.rs @@ -17,14 +17,14 @@ //! Kerberos parser wrapper module. -use nom7::IResult; -use nom7::error::{ErrorKind, ParseError}; -use nom7::number::streaming::le_u16; use der_parser6; use der_parser6::der::parse_der_oid; use der_parser6::error::BerError; use kerberos_parser::krb5::{ApReq, PrincipalName, Realm}; use kerberos_parser::krb5_parser::parse_ap_req; +use nom7::error::{ErrorKind, ParseError}; +use nom7::number::streaming::le_u16; +use nom7::IResult; #[derive(Debug)] pub enum SecBlobError { @@ -55,12 +55,11 @@ pub struct Kerberos5Ticket { pub sname: PrincipalName, } -fn parse_kerberos5_request_do(blob: &[u8]) -> IResult<&[u8], ApReq, SecBlobError> -{ - let (_,b) = der_parser6::parse_der(blob).map_err(nom7::Err::convert)?; - let blob = b.as_slice().or( - Err(nom7::Err::Error(SecBlobError::KrbFmtError)) - )?; +fn parse_kerberos5_request_do(blob: &[u8]) -> IResult<&[u8], ApReq, SecBlobError> { + let (_, b) = der_parser6::parse_der(blob).map_err(nom7::Err::convert)?; + let blob = b + .as_slice() + .or(Err(nom7::Err::Error(SecBlobError::KrbFmtError)))?; let parser = |i| { let (i, _base_o) = parse_der_oid(i)?; let (i, _tok_id) = le_u16(i)?; diff --git a/rust/src/krb/detect.rs b/rust/src/krb/detect.rs index 25cce9bcf826..0e9f33f7ae76 100644 --- a/rust/src/krb/detect.rs +++ b/rust/src/krb/detect.rs @@ -31,14 +31,14 @@ use nom7::IResult; use std::ffi::CStr; #[no_mangle] -pub unsafe extern "C" fn rs_krb5_tx_get_msgtype(tx: &mut KRB5Transaction, ptr: *mut u32) { +pub unsafe extern fn rs_krb5_tx_get_msgtype(tx: &mut KRB5Transaction, ptr: *mut u32) { *ptr = tx.msg_type.0; } /// Get error code, if present in transaction /// Return 0 if error code was filled, else 1 #[no_mangle] -pub unsafe extern "C" fn rs_krb5_tx_get_errcode(tx: &mut KRB5Transaction, ptr: *mut i32) -> u32 { +pub unsafe extern fn rs_krb5_tx_get_errcode(tx: &mut KRB5Transaction, ptr: *mut i32) -> u32 { match tx.error_code { Some(ref e) => { *ptr = e.0; @@ -49,7 +49,7 @@ pub unsafe extern "C" fn rs_krb5_tx_get_errcode(tx: &mut KRB5Transaction, ptr: * } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_tx_get_cname( +pub unsafe extern fn rs_krb5_tx_get_cname( tx: &mut KRB5Transaction, i: u32, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref s) = tx.cname { @@ -64,7 +64,7 @@ pub unsafe extern "C" fn rs_krb5_tx_get_cname( } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_tx_get_sname( +pub unsafe extern fn rs_krb5_tx_get_sname( tx: &mut KRB5Transaction, i: u32, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref s) = tx.sname { @@ -103,7 +103,6 @@ impl DetectKrb5TicketEncryptionList { } } - // Suppress large enum variant lint as the LIST is very large compared // to the boolean variant. #[derive(Debug)] @@ -212,7 +211,7 @@ pub fn detect_parse_encryption(i: &str) -> IResult<&str, DetectKrb5TicketEncrypt } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_detect_encryption_parse( +pub unsafe extern fn rs_krb5_detect_encryption_parse( ustr: *const std::os::raw::c_char, ) -> *mut DetectKrb5TicketEncryptionData { let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe @@ -226,7 +225,7 @@ pub unsafe extern "C" fn rs_krb5_detect_encryption_parse( } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_detect_encryption_match( +pub unsafe extern fn rs_krb5_detect_encryption_match( tx: &mut KRB5Transaction, ctx: &DetectKrb5TicketEncryptionData, ) -> std::os::raw::c_int { if let Some(x) = tx.ticket_etype { @@ -260,7 +259,7 @@ pub unsafe extern "C" fn rs_krb5_detect_encryption_match( } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_detect_encryption_free(ctx: &mut DetectKrb5TicketEncryptionData) { +pub unsafe extern fn rs_krb5_detect_encryption_free(ctx: &mut DetectKrb5TicketEncryptionData) { // Just unbox... std::mem::drop(Box::from_raw(ctx)); } diff --git a/rust/src/krb/krb5.rs b/rust/src/krb/krb5.rs index 3282d50ba78b..fe7af7d0cf60 100644 --- a/rust/src/krb/krb5.rs +++ b/rust/src/krb/krb5.rs @@ -17,17 +17,17 @@ // written by Pierre Chifflier -use std; -use std::ffi::CString; -use nom7::{Err, IResult}; -use nom7::number::streaming::be_u32; -use der_parser::der::der_read_element_header; -use der_parser::ber::Class; -use kerberos_parser::krb5_parser; -use kerberos_parser::krb5::{EncryptionType,ErrorCode,MessageType,PrincipalName,Realm}; use crate::applayer::{self, *}; use crate::core; -use crate::core::{AppProto,Flow,ALPROTO_FAILED,ALPROTO_UNKNOWN,Direction}; +use crate::core::{AppProto, Direction, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN}; +use der_parser::ber::Class; +use der_parser::der::der_read_element_header; +use kerberos_parser::krb5::{EncryptionType, ErrorCode, MessageType, PrincipalName, Realm}; +use kerberos_parser::krb5_parser; +use nom7::number::streaming::be_u32; +use nom7::{Err, IResult}; +use std; +use std::ffi::CString; #[derive(AppLayerEvent)] pub enum KRB5Event { @@ -122,13 +122,15 @@ impl KRB5State { /// Returns 0 in case of success, or -1 on error fn parse(&mut self, i: &[u8], direction: Direction) -> i32 { match der_read_element_header(i) { - Ok((_rem,hdr)) => { + Ok((_rem, hdr)) => { // Kerberos messages start with an APPLICATION header - if hdr.class() != Class::Application { return 0; } + if hdr.class() != Class::Application { + return 0; + } match hdr.tag().0 { 10 => { let req = krb5_parser::parse_as_req(i); - if let Ok((_,kdc_req)) = req { + if let Ok((_, kdc_req)) = req { let mut tx = self.new_tx(direction); tx.msg_type = MessageType::KRB_AS_REQ; tx.cname = kdc_req.req_body.cname; @@ -138,10 +140,10 @@ impl KRB5State { self.transactions.push(tx); }; self.req_id = 10; - }, + } 11 => { let res = krb5_parser::parse_as_rep(i); - if let Ok((_,kdc_rep)) = res { + if let Ok((_, kdc_rep)) = res { let mut tx = self.new_tx(direction); tx.msg_type = MessageType::KRB_AS_REP; if self.req_id > 0 { @@ -160,10 +162,10 @@ impl KRB5State { } }; self.req_id = 0; - }, + } 12 => { let req = krb5_parser::parse_tgs_req(i); - if let Ok((_,kdc_req)) = req { + if let Ok((_, kdc_req)) = req { let mut tx = self.new_tx(direction); tx.msg_type = MessageType::KRB_TGS_REQ; tx.cname = kdc_req.req_body.cname; @@ -173,10 +175,10 @@ impl KRB5State { self.transactions.push(tx); }; self.req_id = 12; - }, + } 13 => { let res = krb5_parser::parse_tgs_rep(i); - if let Ok((_,kdc_rep)) = res { + if let Ok((_, kdc_rep)) = res { let mut tx = self.new_tx(direction); tx.msg_type = MessageType::KRB_TGS_REP; if self.req_id > 0 { @@ -195,16 +197,16 @@ impl KRB5State { } }; self.req_id = 0; - }, + } 14 => { self.req_id = 14; - }, + } 15 => { self.req_id = 0; - }, + } 30 => { let res = krb5_parser::parse_krb_error(i); - if let Ok((_,error)) = res { + if let Ok((_, error)) = res { let mut tx = self.new_tx(direction); if self.req_id > 0 { // set request type only if previous message @@ -219,21 +221,23 @@ impl KRB5State { self.transactions.push(tx); }; self.req_id = 0; - }, - _ => { SCLogDebug!("unknown/unsupported tag {}", hdr.tag()); }, + } + _ => { + SCLogDebug!("unknown/unsupported tag {}", hdr.tag()); + } } 0 - }, + } Err(Err::Incomplete(_)) => { SCLogDebug!("Insufficient data while parsing KRB5 data"); self.set_event(KRB5Event::MalformedData); -1 - }, + } Err(_) => { SCLogDebug!("Error while parsing KRB5 data"); self.set_event(KRB5Event::MalformedData); -1 - }, + } } } @@ -270,7 +274,7 @@ impl KRB5State { impl KRB5Transaction { pub fn new(direction: Direction, id: u64) -> KRB5Transaction { - let krbtx = KRB5Transaction{ + let krbtx = KRB5Transaction { msg_type: MessageType(0), cname: None, realm: None, @@ -287,25 +291,23 @@ impl KRB5Transaction { } /// Return true if Kerberos `EncryptionType` is weak -pub fn test_weak_encryption(alg:EncryptionType) -> bool { +pub fn test_weak_encryption(alg: EncryptionType) -> bool { match alg { - EncryptionType::AES128_CTS_HMAC_SHA1_96 | - EncryptionType::AES256_CTS_HMAC_SHA1_96 | - EncryptionType::AES128_CTS_HMAC_SHA256_128 | - EncryptionType::AES256_CTS_HMAC_SHA384_192 | - EncryptionType::CAMELLIA128_CTS_CMAC | - EncryptionType::CAMELLIA256_CTS_CMAC => false, + EncryptionType::AES128_CTS_HMAC_SHA1_96 + | EncryptionType::AES256_CTS_HMAC_SHA1_96 + | EncryptionType::AES128_CTS_HMAC_SHA256_128 + | EncryptionType::AES256_CTS_HMAC_SHA384_192 + | EncryptionType::CAMELLIA128_CTS_CMAC + | EncryptionType::CAMELLIA256_CTS_CMAC => false, _ => true, // all other ciphers are weak or deprecated } } - - - - /// Returns *mut KRB5State #[no_mangle] -pub extern "C" fn rs_krb5_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_krb5_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = KRB5State::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; @@ -314,121 +316,122 @@ pub extern "C" fn rs_krb5_state_new(_orig_state: *mut std::os::raw::c_void, _ori /// Params: /// - state: *mut KRB5State as void pointer #[no_mangle] -pub extern "C" fn rs_krb5_state_free(state: *mut std::os::raw::c_void) { - let mut state: Box = unsafe{Box::from_raw(state as _)}; +pub extern fn rs_krb5_state_free(state: *mut std::os::raw::c_void) { + let mut state: Box = unsafe { Box::from_raw(state as _) }; state.free(); } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_state_get_tx(state: *mut std::os::raw::c_void, - tx_id: u64) - -> *mut std::os::raw::c_void -{ - let state = cast_pointer!(state,KRB5State); +pub unsafe extern fn rs_krb5_state_get_tx( + state: *mut std::os::raw::c_void, tx_id: u64, +) -> *mut std::os::raw::c_void { + let state = cast_pointer!(state, KRB5State); match state.get_tx_by_id(tx_id) { Some(tx) => tx as *const _ as *mut _, - None => std::ptr::null_mut(), + None => std::ptr::null_mut(), } } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_state_get_tx_count(state: *mut std::os::raw::c_void) - -> u64 -{ - let state = cast_pointer!(state,KRB5State); +pub unsafe extern fn rs_krb5_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { + let state = cast_pointer!(state, KRB5State); state.tx_id } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_state_tx_free(state: *mut std::os::raw::c_void, - tx_id: u64) -{ - let state = cast_pointer!(state,KRB5State); +pub unsafe extern fn rs_krb5_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { + let state = cast_pointer!(state, KRB5State); state.free_tx(tx_id); } #[no_mangle] -pub extern "C" fn rs_krb5_tx_get_alstate_progress(_tx: *mut std::os::raw::c_void, - _direction: u8) - -> std::os::raw::c_int -{ +pub extern fn rs_krb5_tx_get_alstate_progress( + _tx: *mut std::os::raw::c_void, _direction: u8, +) -> std::os::raw::c_int { 1 } -static mut ALPROTO_KRB5 : AppProto = ALPROTO_UNKNOWN; +static mut ALPROTO_KRB5: AppProto = ALPROTO_UNKNOWN; #[no_mangle] -pub unsafe extern "C" fn rs_krb5_probing_parser(_flow: *const Flow, - _direction: u8, - input:*const u8, input_len: u32, - _rdir: *mut u8) -> AppProto -{ - let slice = build_slice!(input,input_len as usize); +pub unsafe extern fn rs_krb5_probing_parser( + _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, +) -> AppProto { + let slice = build_slice!(input, input_len as usize); let alproto = ALPROTO_KRB5; - if slice.len() <= 10 { return ALPROTO_FAILED; } + if slice.len() <= 10 { + return ALPROTO_FAILED; + } match der_read_element_header(slice) { Ok((rem, ref hdr)) => { // Kerberos messages start with an APPLICATION header - if hdr.class() != Class::Application { return ALPROTO_FAILED; } + if hdr.class() != Class::Application { + return ALPROTO_FAILED; + } // Tag number should be <= 30 - if hdr.tag().0 > 30 { return ALPROTO_FAILED; } + if hdr.tag().0 > 30 { + return ALPROTO_FAILED; + } // Kerberos messages contain sequences - if rem.is_empty() || rem[0] != 0x30 { return ALPROTO_FAILED; } + if rem.is_empty() || rem[0] != 0x30 { + return ALPROTO_FAILED; + } // Check kerberos version - if let Ok((rem,_hdr)) = der_read_element_header(rem) { + if let Ok((rem, _hdr)) = der_read_element_header(rem) { if rem.len() > 5 { #[allow(clippy::single_match)] - match (rem[2],rem[3],rem[4]) { + match (rem[2], rem[3], rem[4]) { // Encoding of DER integer 5 (version) - (2,1,5) => { return alproto; }, - _ => (), + (2, 1, 5) => { + return alproto; + } + _ => (), } } } return ALPROTO_FAILED; - }, + } Err(Err::Incomplete(_)) => { return ALPROTO_UNKNOWN; - }, + } Err(_) => { return ALPROTO_FAILED; - }, + } } } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_probing_parser_tcp(_flow: *const Flow, - direction: u8, - input:*const u8, input_len: u32, - rdir: *mut u8) -> AppProto -{ - let slice = build_slice!(input,input_len as usize); - if slice.len() <= 14 { return ALPROTO_FAILED; } - match be_u32(slice) as IResult<&[u8],u32> { +pub unsafe extern fn rs_krb5_probing_parser_tcp( + _flow: *const Flow, direction: u8, input: *const u8, input_len: u32, rdir: *mut u8, +) -> AppProto { + let slice = build_slice!(input, input_len as usize); + if slice.len() <= 14 { + return ALPROTO_FAILED; + } + match be_u32(slice) as IResult<&[u8], u32> { Ok((rem, record_mark)) => { // protocol implementations forbid very large requests - if record_mark > 16384 { return ALPROTO_FAILED; } - return rs_krb5_probing_parser(_flow, direction, - rem.as_ptr(), rem.len() as u32, rdir); - }, + if record_mark > 16384 { + return ALPROTO_FAILED; + } + return rs_krb5_probing_parser(_flow, direction, rem.as_ptr(), rem.len() as u32, rdir); + } Err(Err::Incomplete(_)) => { return ALPROTO_UNKNOWN; - }, + } Err(_) => { return ALPROTO_FAILED; - }, + } } } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_parse_request(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { +pub unsafe extern fn rs_krb5_parse_request( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let buf = stream_slice.as_slice(); - let state = cast_pointer!(state,KRB5State); + let state = cast_pointer!(state, KRB5State); if state.parse(buf, Direction::ToServer) < 0 { return AppLayerResult::err(); } @@ -436,14 +439,12 @@ pub unsafe extern "C" fn rs_krb5_parse_request(_flow: *const core::Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_parse_response(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { +pub unsafe extern fn rs_krb5_parse_response( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let buf = stream_slice.as_slice(); - let state = cast_pointer!(state,KRB5State); + let state = cast_pointer!(state, KRB5State); if state.parse(buf, Direction::ToClient) < 0 { return AppLayerResult::err(); } @@ -451,23 +452,24 @@ pub unsafe extern "C" fn rs_krb5_parse_response(_flow: *const core::Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_parse_request_tcp(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { - let state = cast_pointer!(state,KRB5State); +pub unsafe extern fn rs_krb5_parse_request_tcp( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { + let state = cast_pointer!(state, KRB5State); let buf = stream_slice.as_slice(); - let mut v : Vec; + let mut v: Vec; let tcp_buffer = match state.record_ts { 0 => buf, _ => { // sanity check to avoid memory exhaustion if state.defrag_buf_ts.len() + buf.len() > 100000 { - SCLogDebug!("rs_krb5_parse_request_tcp: TCP buffer exploded {} {}", - state.defrag_buf_ts.len(), buf.len()); + SCLogDebug!( + "rs_krb5_parse_request_tcp: TCP buffer exploded {} {}", + state.defrag_buf_ts.len(), + buf.len() + ); return AppLayerResult::err(); } v = state.defrag_buf_ts.split_off(0); @@ -478,11 +480,11 @@ pub unsafe extern "C" fn rs_krb5_parse_request_tcp(_flow: *const core::Flow, let mut cur_i = tcp_buffer; while !cur_i.is_empty() { if state.record_ts == 0 { - match be_u32(cur_i) as IResult<&[u8],u32> { - Ok((rem,record)) => { + match be_u32(cur_i) as IResult<&[u8], u32> { + Ok((rem, record)) => { state.record_ts = record as usize; cur_i = rem; - }, + } Err(Err::Incomplete(_)) => { state.defrag_buf_ts.extend_from_slice(cur_i); return AppLayerResult::ok(); @@ -509,23 +511,24 @@ pub unsafe extern "C" fn rs_krb5_parse_request_tcp(_flow: *const core::Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_krb5_parse_response_tcp(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { - let state = cast_pointer!(state,KRB5State); +pub unsafe extern fn rs_krb5_parse_response_tcp( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { + let state = cast_pointer!(state, KRB5State); let buf = stream_slice.as_slice(); - let mut v : Vec; + let mut v: Vec; let tcp_buffer = match state.record_tc { 0 => buf, _ => { // sanity check to avoid memory exhaustion if state.defrag_buf_tc.len() + buf.len() > 100000 { - SCLogDebug!("rs_krb5_parse_response_tcp: TCP buffer exploded {} {}", - state.defrag_buf_tc.len(), buf.len()); + SCLogDebug!( + "rs_krb5_parse_response_tcp: TCP buffer exploded {} {}", + state.defrag_buf_tc.len(), + buf.len() + ); return AppLayerResult::err(); } v = state.defrag_buf_tc.split_off(0); @@ -536,11 +539,11 @@ pub unsafe extern "C" fn rs_krb5_parse_response_tcp(_flow: *const core::Flow, let mut cur_i = tcp_buffer; while !cur_i.is_empty() { if state.record_tc == 0 { - match be_u32(cur_i) as IResult<&[u8],_> { - Ok((rem,record)) => { + match be_u32(cur_i) as IResult<&[u8], _> { + Ok((rem, record)) => { state.record_tc = record as usize; cur_i = rem; - }, + } Err(Err::Incomplete(_)) => { state.defrag_buf_tc.extend_from_slice(cur_i); return AppLayerResult::ok(); @@ -569,40 +572,40 @@ pub unsafe extern "C" fn rs_krb5_parse_response_tcp(_flow: *const core::Flow, export_tx_data_get!(rs_krb5_get_tx_data, KRB5Transaction); export_state_data_get!(rs_krb5_get_state_data, KRB5State); -const PARSER_NAME : &[u8] = b"krb5\0"; +const PARSER_NAME: &[u8] = b"krb5\0"; #[no_mangle] -pub unsafe extern "C" fn rs_register_krb5_parser() { +pub unsafe extern fn rs_register_krb5_parser() { let default_port = CString::new("88").unwrap(); let mut parser = RustParser { - name : PARSER_NAME.as_ptr() as *const std::os::raw::c_char, - default_port : default_port.as_ptr(), - ipproto : core::IPPROTO_UDP, - probe_ts : Some(rs_krb5_probing_parser), - probe_tc : Some(rs_krb5_probing_parser), - min_depth : 0, - max_depth : 16, - state_new : rs_krb5_state_new, - state_free : rs_krb5_state_free, - tx_free : rs_krb5_state_tx_free, - parse_ts : rs_krb5_parse_request, - parse_tc : rs_krb5_parse_response, - get_tx_count : rs_krb5_state_get_tx_count, - get_tx : rs_krb5_state_get_tx, - tx_comp_st_ts : 1, - tx_comp_st_tc : 1, - tx_get_progress : rs_krb5_tx_get_alstate_progress, - get_eventinfo : Some(KRB5Event::get_event_info), - get_eventinfo_byid : Some(KRB5Event::get_event_info_by_id), - localstorage_new : None, - localstorage_free : None, - get_tx_files : None, - get_tx_iterator : Some(applayer::state_get_tx_iterator::), - get_tx_data : rs_krb5_get_tx_data, - get_state_data : rs_krb5_get_state_data, - apply_tx_config : None, - flags : 0, - truncate : None, + name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, + default_port: default_port.as_ptr(), + ipproto: core::IPPROTO_UDP, + probe_ts: Some(rs_krb5_probing_parser), + probe_tc: Some(rs_krb5_probing_parser), + min_depth: 0, + max_depth: 16, + state_new: rs_krb5_state_new, + state_free: rs_krb5_state_free, + tx_free: rs_krb5_state_tx_free, + parse_ts: rs_krb5_parse_request, + parse_tc: rs_krb5_parse_response, + get_tx_count: rs_krb5_state_get_tx_count, + get_tx: rs_krb5_state_get_tx, + tx_comp_st_ts: 1, + tx_comp_st_tc: 1, + tx_get_progress: rs_krb5_tx_get_alstate_progress, + get_eventinfo: Some(KRB5Event::get_event_info), + get_eventinfo_byid: Some(KRB5Event::get_event_info_by_id), + localstorage_new: None, + localstorage_free: None, + get_tx_files: None, + get_tx_iterator: Some(applayer::state_get_tx_iterator::), + get_tx_data: rs_krb5_get_tx_data, + get_state_data: rs_krb5_get_state_data, + apply_tx_config: None, + flags: 0, + truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/krb/log.rs b/rust/src/krb/log.rs index 58c0d64b4893..e3377f35567f 100644 --- a/rust/src/krb/log.rs +++ b/rust/src/krb/log.rs @@ -18,10 +18,9 @@ // written by Pierre Chifflier use crate::jsonbuilder::{JsonBuilder, JsonError}; -use crate::krb::krb5::{KRB5Transaction,test_weak_encryption}; +use crate::krb::krb5::{test_weak_encryption, KRB5Transaction}; -fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<(), JsonError> -{ +fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<(), JsonError> { jsb.open_object("krb5")?; match tx.error_code { Some(c) => { @@ -35,30 +34,35 @@ fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result< jsb.set_string("failed_request", "UNKNOWN")?; } jsb.set_string("error_code", &format!("{:?}", c))?; - }, - None => { jsb.set_string("msg_type", &format!("{:?}", tx.msg_type))?; }, + } + None => { + jsb.set_string("msg_type", &format!("{:?}", tx.msg_type))?; + } } let cname = match tx.cname { Some(ref x) => format!("{}", x), - None => "".to_owned(), + None => "".to_owned(), }; let realm = match tx.realm { Some(ref x) => x.0.to_string(), - None => "".to_owned(), + None => "".to_owned(), }; let sname = match tx.sname { Some(ref x) => format!("{}", x), - None => "".to_owned(), + None => "".to_owned(), }; let encryption = match tx.etype { Some(ref x) => format!("{:?}", x), - None => "".to_owned(), + None => "".to_owned(), }; jsb.set_string("cname", &cname)?; jsb.set_string("realm", &realm)?; jsb.set_string("sname", &sname)?; jsb.set_string("encryption", &encryption)?; - jsb.set_bool("weak_encryption", tx.etype.map_or(false,test_weak_encryption))?; + jsb.set_bool( + "weak_encryption", + tx.etype.map_or(false, test_weak_encryption), + )?; if let Some(x) = tx.ticket_etype { let refs = format!("{:?}", x); jsb.set_string("ticket_encryption", &refs)?; @@ -70,7 +74,6 @@ fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result< } #[no_mangle] -pub extern "C" fn rs_krb5_log_json_response(tx: &mut KRB5Transaction, jsb: &mut JsonBuilder) -> bool -{ +pub extern fn rs_krb5_log_json_response(tx: &mut KRB5Transaction, jsb: &mut JsonBuilder) -> bool { krb5_log_response(jsb, tx).is_ok() } diff --git a/rust/src/krb/mod.rs b/rust/src/krb/mod.rs index ca6237d7bb6b..d13990241dd4 100644 --- a/rust/src/krb/mod.rs +++ b/rust/src/krb/mod.rs @@ -19,6 +19,6 @@ // written by Pierre Chifflier -pub mod krb5; pub mod detect; +pub mod krb5; pub mod log; diff --git a/rust/src/lib.rs b/rust/src/lib.rs index da2859637783..e1ac51e165a2 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -21,27 +21,21 @@ //! the components written in Rust. #![cfg_attr(feature = "strict", deny(warnings))] - // Allow these patterns as its a style we like. #![allow(clippy::needless_return)] #![allow(clippy::let_and_return)] #![allow(clippy::uninlined_format_args)] - // We find this makes sense at time. #![allow(clippy::module_inception)] - // The match macro is not always more clear. But its use is // recommended where it makes sense. #![allow(clippy::match_like_matches_macro)] - // Something we should be conscious of, but due to interfacing with C // is unavoidable at this time. #![allow(clippy::too_many_arguments)] - // This would be nice, but having this lint enables causes // clippy --fix to make changes that don't meet our MSRV. #![allow(clippy::derivable_impls)] - // TODO: All unsafe functions should have a safety doc, even if its // just due to FFI. #![allow(clippy::missing_safety_doc)] @@ -75,44 +69,44 @@ pub mod conf; pub mod jsonbuilder; #[macro_use] pub mod applayer; -pub mod frames; +pub mod detect; pub mod filecontainer; pub mod filetracker; +pub mod frames; pub mod kerberos; -pub mod detect; #[cfg(feature = "lua")] pub mod lua; +pub mod dcerpc; pub mod dns; -pub mod nfs; pub mod ftp; -pub mod smb; pub mod krb; -pub mod dcerpc; pub mod modbus; +pub mod nfs; +pub mod smb; pub mod ike; pub mod snmp; -pub mod ntp; -pub mod tftp; +pub mod applayertemplate; +pub mod asn1; +pub mod bittorrent_dht; pub mod dhcp; -pub mod sip; -pub mod rfb; +pub mod ffi; +pub mod http2; +pub mod lzma; +pub mod mime; pub mod mqtt; +pub mod ntp; pub mod pgsql; -pub mod telnet; -pub mod applayertemplate; +pub mod plugin; +pub mod quic; pub mod rdp; -pub mod x509; -pub mod asn1; -pub mod mime; +pub mod rfb; +pub mod sip; pub mod ssh; -pub mod http2; -pub mod quic; -pub mod bittorrent_dht; -pub mod plugin; -pub mod lzma; +pub mod telnet; +pub mod tftp; pub mod util; -pub mod ffi; +pub mod x509; diff --git a/rust/src/log.rs b/rust/src/log.rs index 744169a97039..45344717730b 100644 --- a/rust/src/log.rs +++ b/rust/src/log.rs @@ -41,9 +41,7 @@ pub enum Level { pub static mut LEVEL: i32 = Level::NotSet as i32; pub fn get_log_level() -> i32 { - unsafe { - LEVEL - } + unsafe { LEVEL } } pub fn log_set_level(level: i32) { @@ -53,7 +51,7 @@ pub fn log_set_level(level: i32) { } #[no_mangle] -pub extern "C" fn rs_log_set_level(level: i32) { +pub extern fn rs_log_set_level(level: i32) { log_set_level(level); } @@ -67,17 +65,10 @@ fn basename(filename: &str) -> &str { return filename; } -pub fn sclog(level: Level, file: &str, line: u32, function: &str, - message: &str) -{ +pub fn sclog(level: Level, file: &str, line: u32, function: &str, message: &str) { let filename = basename(file); let noext = &filename[0..filename.len() - 3]; - sc_log_message(level, - filename, - line, - function, - noext, - message); + sc_log_message(level, filename, line, function, noext, message); } // This macro returns the function name. @@ -86,16 +77,16 @@ pub fn sclog(level: Level, file: &str, line: u32, function: &str, // is released under the MIT license as there is currently no macro in Rust // to provide the function name. #[macro_export(local_inner_macros)] -macro_rules!function { +macro_rules! function { () => {{ - // Okay, this is ugly, I get it. However, this is the best we can get on a stable rust. - fn __f() {} - fn type_name_of(_: T) -> &'static str { - std::any::type_name::() - } - let name = type_name_of(__f); - &name[..name.len() - 5] - }} + // Okay, this is ugly, I get it. However, this is the best we can get on a stable rust. + fn __f() {} + fn type_name_of(_: T) -> &'static str { + std::any::type_name::() + } + let name = type_name_of(__f); + &name[..name.len() - 5] + }}; } #[macro_export] @@ -158,20 +149,17 @@ macro_rules!SCLogDebug { // about unused variables, but is otherwise the equivalent to a no-op. #[cfg(not(feature = "debug"))] #[macro_export] -macro_rules!SCLogDebug { - ($($arg:tt)*) => () +macro_rules! SCLogDebug { + ($($arg:tt)*) => {}; } /// SCLogMessage wrapper. If the Suricata C context is not registered /// a more basic log format will be used (for example, when running /// Rust unit tests). -pub fn sc_log_message(level: Level, - filename: &str, - line: std::os::raw::c_uint, - function: &str, - module: &str, - message: &str) -> std::os::raw::c_int -{ +pub fn sc_log_message( + level: Level, filename: &str, line: std::os::raw::c_uint, function: &str, module: &str, + message: &str, +) -> std::os::raw::c_int { unsafe { if let Some(c) = SC { return (c.SCLogMessage)( @@ -180,7 +168,8 @@ pub fn sc_log_message(level: Level, line, to_safe_cstring(function).as_ptr(), to_safe_cstring(module).as_ptr(), - to_safe_cstring(message).as_ptr()); + to_safe_cstring(message).as_ptr(), + ); } } @@ -205,8 +194,6 @@ fn to_safe_cstring(val: &str) -> CString { } match CString::new(safe) { Ok(cstr) => cstr, - _ => { - CString::new("").unwrap() - } + _ => CString::new("").unwrap(), } } diff --git a/rust/src/lua.rs b/rust/src/lua.rs index 4fce2a824944..70fb64d9508f 100644 --- a/rust/src/lua.rs +++ b/rust/src/lua.rs @@ -42,7 +42,6 @@ pub struct LuaState { } impl LuaState { - pub fn newtable(&self) { unsafe { lua_createtable(self.lua, 0, 0); diff --git a/rust/src/lzma.rs b/rust/src/lzma.rs index e10d803a6e2c..26041a6154a2 100644 --- a/rust/src/lzma.rs +++ b/rust/src/lzma.rs @@ -57,7 +57,7 @@ impl From for LzmaStatus { /// Use the lzma algorithm to decompress a chunk of data. #[no_mangle] -pub unsafe extern "C" fn lzma_decompress( +pub unsafe extern fn lzma_decompress( input: *const u8, input_len: &mut usize, output: *mut u8, output_len: &mut usize, memlimit: usize, ) -> LzmaStatus { diff --git a/rust/src/mime/mod.rs b/rust/src/mime/mod.rs index 6f4a9bc21301..ec352db8c5c9 100644 --- a/rust/src/mime/mod.rs +++ b/rust/src/mime/mod.rs @@ -40,17 +40,11 @@ pub fn mime_parse_value_delimited(input: &[u8]) -> IResult<&[u8], &[u8]> { pub fn mime_parse_header_token(input: &[u8]) -> IResult<&[u8], (&[u8], &[u8])> { // from RFC2047 : like ch.is_ascii_whitespace but without 0x0c FORM-FEED - let (input, _) = take_while(|ch: u8| ch == 0x20 - || ch == 0x09 - || ch == 0x0a - || ch == 0x0d)(input)?; + let (input, _) = + take_while(|ch: u8| ch == 0x20 || ch == 0x09 || ch == 0x0a || ch == 0x0d)(input)?; let (input, name) = take_until("=")(input)?; let (input, _) = tag("=")(input)?; - let (input, value) = alt(( - mime_parse_value_delimited, - complete(take_until(";")), - rest - ))(input)?; + let (input, value) = alt((mime_parse_value_delimited, complete(take_until(";")), rest))(input)?; let (input, _) = opt(complete(tag(";")))(input)?; return Ok((input, (name, value))); } @@ -133,7 +127,7 @@ fn mime_find_header_token<'a>( pub const RS_MIME_MAX_TOKEN_LEN: usize = 255; #[no_mangle] -pub unsafe extern "C" fn rs_mime_find_header_token( +pub unsafe extern fn rs_mime_find_header_token( hinput: *const u8, hlen: u32, tinput: *const u8, tlen: u32, outbuf: &mut [u8; 255], outlen: *mut u32, ) -> bool { diff --git a/rust/src/modbus/detect.rs b/rust/src/modbus/detect.rs index fdd5d51db9f5..d43b90c3ced8 100644 --- a/rust/src/modbus/detect.rs +++ b/rust/src/modbus/detect.rs @@ -135,7 +135,7 @@ fn parse_range(min_str: &str, max_str: &str) -> Result, ()> { /// Intermediary function between the C code and the parsing functions. #[no_mangle] -pub unsafe extern "C" fn rs_modbus_parse(c_arg: *const c_char) -> *mut c_void { +pub unsafe extern fn rs_modbus_parse(c_arg: *const c_char) -> *mut c_void { if c_arg.is_null() { return std::ptr::null_mut(); } @@ -152,7 +152,7 @@ pub unsafe extern "C" fn rs_modbus_parse(c_arg: *const c_char) -> *mut c_void { } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_free(ptr: *mut c_void) { +pub unsafe extern fn rs_modbus_free(ptr: *mut c_void) { if !ptr.is_null() { let _ = Box::from_raw(ptr as *mut DetectModbusRust); } @@ -161,7 +161,7 @@ pub unsafe extern "C" fn rs_modbus_free(ptr: *mut c_void) { /// Compares a transaction to a signature to determine whether the transaction /// matches the signature. If it does, 1 is returned; otherwise 0 is returned. #[no_mangle] -pub extern "C" fn rs_modbus_inspect(tx: &ModbusTransaction, modbus: &DetectModbusRust) -> u8 { +pub extern fn rs_modbus_inspect(tx: &ModbusTransaction, modbus: &DetectModbusRust) -> u8 { // All necessary information can be found in the request (value inspection currently // only supports write functions, which hold the value in the request). // Only inspect the response in the case where there is no request. diff --git a/rust/src/modbus/log.rs b/rust/src/modbus/log.rs index 6724291de786..1e6e48324a87 100644 --- a/rust/src/modbus/log.rs +++ b/rust/src/modbus/log.rs @@ -21,7 +21,7 @@ use crate::jsonbuilder::{JsonBuilder, JsonError}; use sawp_modbus::{Data, Message, Read, Write}; #[no_mangle] -pub extern "C" fn rs_modbus_to_json(tx: &mut ModbusTransaction, js: &mut JsonBuilder) -> bool { +pub extern fn rs_modbus_to_json(tx: &mut ModbusTransaction, js: &mut JsonBuilder) -> bool { log(tx, js).is_ok() } diff --git a/rust/src/modbus/modbus.rs b/rust/src/modbus/modbus.rs index 246e9cae6d6c..70f5ec64f597 100644 --- a/rust/src/modbus/modbus.rs +++ b/rust/src/modbus/modbus.rs @@ -271,7 +271,7 @@ impl ModbusState { /// Probe input to see if it looks like Modbus. #[no_mangle] -pub extern "C" fn rs_modbus_probe( +pub extern fn rs_modbus_probe( _flow: *const core::Flow, _direction: u8, input: *const u8, len: u32, _rdir: *mut u8, ) -> AppProto { let slice: &[u8] = unsafe { std::slice::from_raw_parts(input as *mut u8, len as usize) }; @@ -283,28 +283,27 @@ pub extern "C" fn rs_modbus_probe( } #[no_mangle] -pub extern "C" fn rs_modbus_state_new( +pub extern fn rs_modbus_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { Box::into_raw(Box::new(ModbusState::new())) as *mut std::os::raw::c_void } #[no_mangle] -pub extern "C" fn rs_modbus_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_modbus_state_free(state: *mut std::os::raw::c_void) { let _state: Box = unsafe { Box::from_raw(state as *mut ModbusState) }; } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_modbus_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, ModbusState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_parse_request( +pub unsafe extern fn rs_modbus_parse_request( _flow: *const core::Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let buf = stream_slice.as_slice(); if buf.is_empty() { @@ -320,10 +319,9 @@ pub unsafe extern "C" fn rs_modbus_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_parse_response( +pub unsafe extern fn rs_modbus_parse_response( _flow: *const core::Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let buf = stream_slice.as_slice(); if buf.is_empty() { @@ -339,13 +337,13 @@ pub unsafe extern "C" fn rs_modbus_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_modbus_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, ModbusState); state.tx_id } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_state_get_tx( +pub unsafe extern fn rs_modbus_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, ModbusState); @@ -356,7 +354,7 @@ pub unsafe extern "C" fn rs_modbus_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_tx_get_alstate_progress( +pub unsafe extern fn rs_modbus_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, ModbusTransaction); @@ -364,7 +362,7 @@ pub unsafe extern "C" fn rs_modbus_tx_get_alstate_progress( } #[no_mangle] -pub unsafe extern "C" fn rs_modbus_state_get_tx_data( +pub unsafe extern fn rs_modbus_state_get_tx_data( tx: *mut std::os::raw::c_void, ) -> *mut AppLayerTxData { let tx = cast_pointer!(tx, ModbusTransaction); @@ -374,7 +372,7 @@ pub unsafe extern "C" fn rs_modbus_state_get_tx_data( export_state_data_get!(rs_modbus_get_state_data, ModbusState); #[no_mangle] -pub unsafe extern "C" fn rs_modbus_register_parser() { +pub unsafe extern fn rs_modbus_register_parser() { let default_port = std::ffi::CString::new("[502]").unwrap(); let parser = RustParser { name: b"modbus\0".as_ptr() as *const std::os::raw::c_char, @@ -410,7 +408,12 @@ pub unsafe extern "C" fn rs_modbus_register_parser() { }; let ip_proto_str = CString::new("tcp").unwrap(); - if AppLayerProtoDetectConfProtoDetectionEnabledDefault(ip_proto_str.as_ptr(), parser.name, false) != 0 { + if AppLayerProtoDetectConfProtoDetectionEnabledDefault( + ip_proto_str.as_ptr(), + parser.name, + false, + ) != 0 + { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_MODBUS = alproto; if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { @@ -428,14 +431,14 @@ pub mod test { pub struct ModbusMessage(*const c_void); #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_function(msg: *const ModbusMessage) -> u8 { + pub unsafe extern fn rs_modbus_message_get_function(msg: *const ModbusMessage) -> u8 { let msg = msg.as_ref().unwrap().0 as *const Message; let msg = msg.as_ref().unwrap(); msg.function.raw } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_subfunction(msg: *const ModbusMessage) -> u16 { + pub unsafe extern fn rs_modbus_message_get_subfunction(msg: *const ModbusMessage) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; let msg = msg.as_ref().unwrap(); if let Data::Diagnostic { func, data: _ } = &msg.data { @@ -446,7 +449,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_read_request_address( + pub unsafe extern fn rs_modbus_message_get_read_request_address( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -463,7 +466,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_read_request_quantity( + pub unsafe extern fn rs_modbus_message_get_read_request_quantity( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -480,7 +483,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_rw_multreq_read_address( + pub unsafe extern fn rs_modbus_message_get_rw_multreq_read_address( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -501,7 +504,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_rw_multreq_read_quantity( + pub unsafe extern fn rs_modbus_message_get_rw_multreq_read_quantity( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -522,7 +525,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_rw_multreq_write_address( + pub unsafe extern fn rs_modbus_message_get_rw_multreq_write_address( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -544,7 +547,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_rw_multreq_write_quantity( + pub unsafe extern fn rs_modbus_message_get_rw_multreq_write_quantity( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -566,7 +569,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_rw_multreq_write_data( + pub unsafe extern fn rs_modbus_message_get_rw_multreq_write_data( msg: *const ModbusMessage, data_len: *mut usize, ) -> *const u8 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -589,7 +592,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_write_multreq_address( + pub unsafe extern fn rs_modbus_message_get_write_multreq_address( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -607,7 +610,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_write_multreq_quantity( + pub unsafe extern fn rs_modbus_message_get_write_multreq_quantity( msg: *const ModbusMessage, ) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -625,7 +628,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_write_multreq_data( + pub unsafe extern fn rs_modbus_message_get_write_multreq_data( msg: *const ModbusMessage, data_len: *mut usize, ) -> *const u8 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -644,7 +647,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_and_mask(msg: *const ModbusMessage) -> u16 { + pub unsafe extern fn rs_modbus_message_get_and_mask(msg: *const ModbusMessage) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; let msg = msg.as_ref().unwrap(); if let Data::Write(Write::Mask { @@ -660,7 +663,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_or_mask(msg: *const ModbusMessage) -> u16 { + pub unsafe extern fn rs_modbus_message_get_or_mask(msg: *const ModbusMessage) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; let msg = msg.as_ref().unwrap(); if let Data::Write(Write::Mask { @@ -676,7 +679,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_write_address(msg: *const ModbusMessage) -> u16 { + pub unsafe extern fn rs_modbus_message_get_write_address(msg: *const ModbusMessage) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; let msg = msg.as_ref().unwrap(); if let Data::Write(Write::Other { address, data: _ }) = &msg.data { @@ -687,7 +690,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_write_data(msg: *const ModbusMessage) -> u16 { + pub unsafe extern fn rs_modbus_message_get_write_data(msg: *const ModbusMessage) -> u16 { let msg = msg.as_ref().unwrap().0 as *const Message; let msg = msg.as_ref().unwrap(); if let Data::Write(Write::Other { address: _, data }) = &msg.data { @@ -698,7 +701,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_message_get_bytevec_data( + pub unsafe extern fn rs_modbus_message_get_bytevec_data( msg: *const ModbusMessage, data_len: *mut usize, ) -> *const u8 { let msg = msg.as_ref().unwrap().0 as *const Message; @@ -712,7 +715,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_state_get_tx_request( + pub unsafe extern fn rs_modbus_state_get_tx_request( state: *mut std::os::raw::c_void, tx_id: u64, ) -> ModbusMessage { let state = cast_pointer!(state, ModbusState); @@ -728,7 +731,7 @@ pub mod test { } #[no_mangle] - pub unsafe extern "C" fn rs_modbus_state_get_tx_response( + pub unsafe extern fn rs_modbus_state_get_tx_response( state: *mut std::os::raw::c_void, tx_id: u64, ) -> ModbusMessage { let state = cast_pointer!(state, ModbusState); diff --git a/rust/src/mqtt/detect.rs b/rust/src/mqtt/detect.rs index df0c78e8497f..e3f0a8e358f4 100644 --- a/rust/src/mqtt/detect.rs +++ b/rust/src/mqtt/detect.rs @@ -50,7 +50,7 @@ fn check_flag_state(flag_state: MQTTFlagState, flag_value: bool, ok: &mut bool) } #[no_mangle] -pub extern "C" fn rs_mqtt_tx_has_type(tx: &MQTTTransaction, mtype: u8) -> u8 { +pub extern fn rs_mqtt_tx_has_type(tx: &MQTTTransaction, mtype: u8) -> u8 { for msg in tx.msg.iter() { if mtype == msg.header.message_type as u8 { return 1; @@ -60,7 +60,7 @@ pub extern "C" fn rs_mqtt_tx_has_type(tx: &MQTTTransaction, mtype: u8) -> u8 { } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_cstr_message_code( +pub unsafe extern fn rs_mqtt_cstr_message_code( str: *const std::os::raw::c_char, ) -> std::os::raw::c_int { let msgtype: &CStr = CStr::from_ptr(str); @@ -73,7 +73,7 @@ pub unsafe extern "C" fn rs_mqtt_cstr_message_code( } #[no_mangle] -pub extern "C" fn rs_mqtt_tx_has_flags( +pub extern fn rs_mqtt_tx_has_flags( tx: &MQTTTransaction, qretain: MQTTFlagState, qdup: MQTTFlagState, ) -> u8 { for msg in tx.msg.iter() { @@ -89,7 +89,7 @@ pub extern "C" fn rs_mqtt_tx_has_flags( } #[no_mangle] -pub extern "C" fn rs_mqtt_tx_has_qos(tx: &MQTTTransaction, qos: u8) -> u8 { +pub extern fn rs_mqtt_tx_has_qos(tx: &MQTTTransaction, qos: u8) -> u8 { for msg in tx.msg.iter() { if qos == msg.header.qos_level { return 1; @@ -99,12 +99,12 @@ pub extern "C" fn rs_mqtt_tx_has_qos(tx: &MQTTTransaction, qos: u8) -> u8 { } #[no_mangle] -pub extern "C" fn rs_mqtt_tx_get_protocol_version(state: &MQTTState) -> u8 { +pub extern fn rs_mqtt_tx_get_protocol_version(state: &MQTTState) -> u8 { return state.protocol_version; } #[no_mangle] -pub extern "C" fn rs_mqtt_tx_has_connect_flags( +pub extern fn rs_mqtt_tx_has_connect_flags( tx: &MQTTTransaction, username: MQTTFlagState, password: MQTTFlagState, will: MQTTFlagState, will_retain: MQTTFlagState, clean_session: MQTTFlagState, ) -> u8 { @@ -125,7 +125,7 @@ pub extern "C" fn rs_mqtt_tx_has_connect_flags( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_connect_clientid( +pub unsafe extern fn rs_mqtt_tx_get_connect_clientid( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -145,7 +145,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_connect_clientid( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_connect_username( +pub unsafe extern fn rs_mqtt_tx_get_connect_username( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -167,7 +167,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_connect_username( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_connect_password( +pub unsafe extern fn rs_mqtt_tx_get_connect_password( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -188,7 +188,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_connect_password( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_connect_willtopic( +pub unsafe extern fn rs_mqtt_tx_get_connect_willtopic( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -210,7 +210,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_connect_willtopic( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_connect_willmessage( +pub unsafe extern fn rs_mqtt_tx_get_connect_willmessage( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -232,7 +232,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_connect_willmessage( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_connect_protocol_string( +pub unsafe extern fn rs_mqtt_tx_get_connect_protocol_string( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -252,7 +252,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_connect_protocol_string( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_connack_sessionpresent( +pub unsafe extern fn rs_mqtt_tx_get_connack_sessionpresent( tx: &MQTTTransaction, session_present: *mut bool, ) -> u8 { for msg in tx.msg.iter() { @@ -265,7 +265,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_connack_sessionpresent( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_publish_topic( +pub unsafe extern fn rs_mqtt_tx_get_publish_topic( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -286,7 +286,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_publish_topic( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_publish_message( +pub unsafe extern fn rs_mqtt_tx_get_publish_message( tx: &MQTTTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { for msg in tx.msg.iter() { @@ -307,7 +307,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_publish_message( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_subscribe_topic( +pub unsafe extern fn rs_mqtt_tx_get_subscribe_topic( tx: &MQTTTransaction, i: u32, buf: *mut *const u8, len: *mut u32, ) -> u8 { let mut offset = 0; @@ -333,7 +333,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_subscribe_topic( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_unsubscribe_topic( +pub unsafe extern fn rs_mqtt_tx_get_unsubscribe_topic( tx: &MQTTTransaction, i: u32, buf: *mut *const u8, len: *mut u32, ) -> u8 { let mut offset = 0; @@ -359,7 +359,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_unsubscribe_topic( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_reason_code(tx: &MQTTTransaction, result: *mut u8) -> u8 { +pub unsafe extern fn rs_mqtt_tx_get_reason_code(tx: &MQTTTransaction, result: *mut u8) -> u8 { for msg in tx.msg.iter() { match msg.op { MQTTOperation::PUBACK(ref v) @@ -392,7 +392,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_reason_code(tx: &MQTTTransaction, result } #[no_mangle] -pub extern "C" fn rs_mqtt_tx_unsuback_has_reason_code(tx: &MQTTTransaction, code: u8) -> u8 { +pub extern fn rs_mqtt_tx_unsuback_has_reason_code(tx: &MQTTTransaction, code: u8) -> u8 { for msg in tx.msg.iter() { if let MQTTOperation::UNSUBACK(ref unsuback) = msg.op { if let Some(ref reason_codes) = unsuback.reason_codes { @@ -410,28 +410,31 @@ pub extern "C" fn rs_mqtt_tx_unsuback_has_reason_code(tx: &MQTTTransaction, code #[cfg(test)] mod test { use super::*; + use crate::core::Direction; use crate::mqtt::mqtt::MQTTTransaction; use crate::mqtt::mqtt_message::*; use crate::mqtt::parser::FixedHeader; - use crate::core::Direction; use std; #[test] fn test_multi_unsubscribe() { - let mut t = MQTTTransaction::new(MQTTMessage { - header: FixedHeader { - message_type: MQTTTypeCode::UNSUBSCRIBE, - dup_flag: false, - qos_level: 0, - retain: false, - remaining_length: 0, + let mut t = MQTTTransaction::new( + MQTTMessage { + header: FixedHeader { + message_type: MQTTTypeCode::UNSUBSCRIBE, + dup_flag: false, + qos_level: 0, + retain: false, + remaining_length: 0, + }, + op: MQTTOperation::UNSUBSCRIBE(MQTTUnsubscribeData { + message_id: 1, + topics: vec!["foo".to_string(), "baar".to_string()], + properties: None, + }), }, - op: MQTTOperation::UNSUBSCRIBE(MQTTUnsubscribeData { - message_id: 1, - topics: vec!["foo".to_string(), "baar".to_string()], - properties: None, - }), - }, Direction::ToServer); + Direction::ToServer, + ); t.msg.push(MQTTMessage { header: FixedHeader { message_type: MQTTTypeCode::UNSUBSCRIBE, @@ -470,29 +473,32 @@ mod test { #[test] fn test_multi_subscribe() { - let mut t = MQTTTransaction::new(MQTTMessage { - header: FixedHeader { - message_type: MQTTTypeCode::SUBSCRIBE, - dup_flag: false, - qos_level: 0, - retain: false, - remaining_length: 0, + let mut t = MQTTTransaction::new( + MQTTMessage { + header: FixedHeader { + message_type: MQTTTypeCode::SUBSCRIBE, + dup_flag: false, + qos_level: 0, + retain: false, + remaining_length: 0, + }, + op: MQTTOperation::SUBSCRIBE(MQTTSubscribeData { + message_id: 1, + topics: vec![ + MQTTSubscribeTopicData { + topic_name: "foo".to_string(), + qos: 0, + }, + MQTTSubscribeTopicData { + topic_name: "baar".to_string(), + qos: 1, + }, + ], + properties: None, + }), }, - op: MQTTOperation::SUBSCRIBE(MQTTSubscribeData { - message_id: 1, - topics: vec![ - MQTTSubscribeTopicData { - topic_name: "foo".to_string(), - qos: 0, - }, - MQTTSubscribeTopicData { - topic_name: "baar".to_string(), - qos: 1, - }, - ], - properties: None, - }), - }, Direction::ToServer); + Direction::ToServer, + ); t.msg.push(MQTTMessage { header: FixedHeader { message_type: MQTTTypeCode::SUBSCRIBE, diff --git a/rust/src/mqtt/logger.rs b/rust/src/mqtt/logger.rs index af0db17bc2b8..653afc8f1081 100644 --- a/rust/src/mqtt/logger.rs +++ b/rust/src/mqtt/logger.rs @@ -297,7 +297,7 @@ fn log_mqtt(tx: &MQTTTransaction, flags: u32, js: &mut JsonBuilder) -> Result<() } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_logger_log( +pub unsafe extern fn rs_mqtt_logger_log( tx: *mut std::os::raw::c_void, flags: u32, js: &mut JsonBuilder, ) -> bool { let tx = cast_pointer!(tx, MQTTTransaction); diff --git a/rust/src/mqtt/mqtt.rs b/rust/src/mqtt/mqtt.rs index f1c37d83c881..3f531c5724af 100644 --- a/rust/src/mqtt/mqtt.rs +++ b/rust/src/mqtt/mqtt.rs @@ -183,11 +183,11 @@ impl MQTTState { } fn new_tx(&mut self, msg: MQTTMessage, toclient: bool) -> MQTTTransaction { - let direction = if toclient { - Direction::ToClient - } else { - Direction::ToServer - }; + let direction = if toclient { + Direction::ToClient + } else { + Direction::ToServer + }; let mut tx = MQTTTransaction::new(msg, direction); self.tx_id += 1; tx.tx_id = self.tx_id; @@ -608,7 +608,11 @@ impl MQTTState { } fn set_event_notx(&mut self, event: MQTTEvent, toclient: bool) { - let mut tx = MQTTTransaction::new_empty(if toclient { Direction::ToClient } else { Direction::ToServer }); + let mut tx = MQTTTransaction::new_empty(if toclient { + Direction::ToClient + } else { + Direction::ToServer + }); self.tx_id += 1; tx.tx_id = self.tx_id; if toclient { @@ -644,7 +648,7 @@ impl MQTTState { // C exports. #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_probing_parser( +pub unsafe extern fn rs_mqtt_probing_parser( _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { let buf = build_slice!(input, input_len as usize); @@ -666,7 +670,7 @@ pub unsafe extern "C" fn rs_mqtt_probing_parser( } #[no_mangle] -pub extern "C" fn rs_mqtt_state_new( +pub extern fn rs_mqtt_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = MQTTState::new(); @@ -675,18 +679,18 @@ pub extern "C" fn rs_mqtt_state_new( } #[no_mangle] -pub extern "C" fn rs_mqtt_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_mqtt_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(unsafe { Box::from_raw(state as *mut MQTTState) }); } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_mqtt_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, MQTTState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_parse_request( +pub unsafe extern fn rs_mqtt_parse_request( flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -695,7 +699,7 @@ pub unsafe extern "C" fn rs_mqtt_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_parse_response( +pub unsafe extern fn rs_mqtt_parse_response( flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -704,7 +708,7 @@ pub unsafe extern "C" fn rs_mqtt_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_state_get_tx( +pub unsafe extern fn rs_mqtt_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, MQTTState); @@ -719,13 +723,13 @@ pub unsafe extern "C" fn rs_mqtt_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_mqtt_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, MQTTState); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_is_toclient( +pub unsafe extern fn rs_mqtt_tx_is_toclient( tx: *const std::os::raw::c_void, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, MQTTTransaction); @@ -736,7 +740,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_is_toclient( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_alstate_progress( +pub unsafe extern fn rs_mqtt_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, direction: u8, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, MQTTTransaction); @@ -756,7 +760,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_alstate_progress( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_get_logged( +pub unsafe extern fn rs_mqtt_tx_get_logged( _state: *mut std::os::raw::c_void, tx: *mut std::os::raw::c_void, ) -> u32 { let tx = cast_pointer!(tx, MQTTTransaction); @@ -764,7 +768,7 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_logged( } #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_tx_set_logged( +pub unsafe extern fn rs_mqtt_tx_set_logged( _state: *mut std::os::raw::c_void, tx: *mut std::os::raw::c_void, logged: u32, ) { let tx = cast_pointer!(tx, MQTTTransaction); @@ -778,7 +782,7 @@ export_tx_data_get!(rs_mqtt_get_tx_data, MQTTTransaction); export_state_data_get!(rs_mqtt_get_state_data, MQTTState); #[no_mangle] -pub unsafe extern "C" fn rs_mqtt_register_parser(cfg_max_msg_len: u32) { +pub unsafe extern fn rs_mqtt_register_parser(cfg_max_msg_len: u32) { let default_port = CString::new("[1883]").unwrap(); let max_msg_len = &mut MAX_MSG_LEN; *max_msg_len = cfg_max_msg_len; diff --git a/rust/src/mqtt/parser.rs b/rust/src/mqtt/parser.rs index 8b1c8c542aba..7a36aca737bc 100644 --- a/rust/src/mqtt/parser.rs +++ b/rust/src/mqtt/parser.rs @@ -242,8 +242,7 @@ fn parse_connack(protocol_version: u8) -> impl Fn(&[u8]) -> IResult<&[u8], MQTTC #[inline] fn parse_publish( - protocol_version: u8, - has_id: bool, + protocol_version: u8, has_id: bool, ) -> impl Fn(&[u8]) -> IResult<&[u8], MQTTPublishData> { move |i: &[u8]| { let (i, topic) = parse_mqtt_string(i)?; @@ -414,8 +413,7 @@ fn parse_unsuback(protocol_version: u8) -> impl Fn(&[u8]) -> IResult<&[u8], MQTT #[inline] fn parse_disconnect( - remaining_len: usize, - protocol_version: u8, + remaining_len: usize, protocol_version: u8, ) -> impl Fn(&[u8]) -> IResult<&[u8], MQTTDisconnectData> { move |input: &[u8]| { if protocol_version < 5 { @@ -486,11 +484,7 @@ fn parse_auth(i: &[u8]) -> IResult<&[u8], MQTTAuthData> { #[inline] fn parse_remaining_message<'a>( - full: &'a [u8], - len: usize, - skiplen: usize, - header: FixedHeader, - message_type: MQTTTypeCode, + full: &'a [u8], len: usize, skiplen: usize, header: FixedHeader, message_type: MQTTTypeCode, protocol_version: u8, ) -> impl Fn(&'a [u8]) -> IResult<&'a [u8], MQTTMessage> { move |input: &'a [u8]| { @@ -632,9 +626,7 @@ fn parse_remaining_message<'a>( } pub fn parse_message( - input: &[u8], - protocol_version: u8, - max_msg_size: usize, + input: &[u8], protocol_version: u8, max_msg_size: usize, ) -> IResult<&[u8], MQTTMessage> { // Parse the fixed header first. This is identical across versions and can // be between 2 and 5 bytes long. diff --git a/rust/src/nfs/log.rs b/rust/src/nfs/log.rs index f6fdc8f5828a..492912769bf7 100644 --- a/rust/src/nfs/log.rs +++ b/rust/src/nfs/log.rs @@ -15,17 +15,14 @@ * 02110-1301, USA. */ -use std::string::String; use crate::jsonbuilder::{JsonBuilder, JsonError}; -use crate::nfs::types::*; use crate::nfs::nfs::*; +use crate::nfs::types::*; use crc::crc32; +use std::string::String; #[no_mangle] -pub extern "C" fn rs_nfs_tx_logging_is_filtered(state: &mut NFSState, - tx: &mut NFSTransaction) - -> u8 -{ +pub extern fn rs_nfs_tx_logging_is_filtered(state: &mut NFSState, tx: &mut NFSTransaction) -> u8 { // TODO probably best to make this configurable if state.nfs_version <= 3 && tx.procedure == NFSPROC3_GETATTR { @@ -35,15 +32,13 @@ pub extern "C" fn rs_nfs_tx_logging_is_filtered(state: &mut NFSState, return 0; } -fn nfs_rename_object(tx: &NFSTransaction, js: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn nfs_rename_object(tx: &NFSTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { let from_str = String::from_utf8_lossy(&tx.file_name); js.set_string("from", &from_str)?; let to_vec = match tx.type_data { - Some(NFSTransactionTypeData::RENAME(ref x)) => { x.to_vec() }, - _ => { Vec::new() } + Some(NFSTransactionTypeData::RENAME(ref x)) => x.to_vec(), + _ => Vec::new(), }; let to_str = String::from_utf8_lossy(&to_vec); @@ -51,9 +46,7 @@ fn nfs_rename_object(tx: &NFSTransaction, js: &mut JsonBuilder) Ok(()) } -fn nfs_creds_object(tx: &NFSTransaction, js: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn nfs_creds_object(tx: &NFSTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { let mach_name = String::from_utf8_lossy(&tx.request_machine_name); js.set_string("machine_name", &mach_name)?; js.set_uint("uid", tx.request_uid as u64)?; @@ -61,9 +54,7 @@ fn nfs_creds_object(tx: &NFSTransaction, js: &mut JsonBuilder) Ok(()) } -fn nfs_file_object(tx: &NFSTransaction, js: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn nfs_file_object(tx: &NFSTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { js.set_bool("first", tx.is_first)?; js.set_bool("last", tx.is_last)?; @@ -86,9 +77,9 @@ fn nfs_handle2crc(bytes: &[u8]) -> u32 { c } -fn nfs_common_header(state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn nfs_common_header( + state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder, +) -> Result<(), JsonError> { js.set_uint("version", state.nfs_version as u64)?; let proc_string = if state.nfs_version < 4 { nfs3_procedure_string(tx.procedure) @@ -110,24 +101,24 @@ fn nfs_common_header(state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder Ok(()) } -fn nfs_log_request(state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn nfs_log_request( + state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder, +) -> Result<(), JsonError> { nfs_common_header(state, tx, js)?; js.set_string("type", "request")?; Ok(()) } #[no_mangle] -pub extern "C" fn rs_nfs_log_json_request(state: &mut NFSState, tx: &mut NFSTransaction, - js: &mut JsonBuilder) -> bool -{ +pub extern fn rs_nfs_log_json_request( + state: &mut NFSState, tx: &mut NFSTransaction, js: &mut JsonBuilder, +) -> bool { nfs_log_request(state, tx, js).is_ok() } -fn nfs_log_response(state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn nfs_log_response( + state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder, +) -> Result<(), JsonError> { nfs_common_header(state, tx, js)?; js.set_string("type", "response")?; @@ -152,15 +143,13 @@ fn nfs_log_response(state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder) } #[no_mangle] -pub extern "C" fn rs_nfs_log_json_response(state: &mut NFSState, tx: &mut NFSTransaction, - js: &mut JsonBuilder) -> bool -{ +pub extern fn rs_nfs_log_json_response( + state: &mut NFSState, tx: &mut NFSTransaction, js: &mut JsonBuilder, +) -> bool { nfs_log_response(state, tx, js).is_ok() } -fn rpc_log_response(tx: &NFSTransaction, js: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn rpc_log_response(tx: &NFSTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { js.set_uint("xid", tx.xid as u64)?; js.set_string("status", &rpc_status_string(tx.rpc_response_status))?; js.set_string("auth_type", &rpc_auth_type_string(tx.auth_type))?; @@ -173,8 +162,6 @@ fn rpc_log_response(tx: &NFSTransaction, js: &mut JsonBuilder) } #[no_mangle] -pub extern "C" fn rs_rpc_log_json_response(tx: &mut NFSTransaction, - js: &mut JsonBuilder) -> bool -{ +pub extern fn rs_rpc_log_json_response(tx: &mut NFSTransaction, js: &mut JsonBuilder) -> bool { rpc_log_response(tx, js).is_ok() } diff --git a/rust/src/nfs/mod.rs b/rust/src/nfs/mod.rs index 2f6fe84df917..5dc3af3b63cc 100644 --- a/rust/src/nfs/mod.rs +++ b/rust/src/nfs/mod.rs @@ -17,17 +17,17 @@ //! NFS application layer, parser, logger module. -pub mod types; -pub mod rpc_records; -pub mod nfs_records; -pub mod nfs2_records; -pub mod nfs3_records; -pub mod nfs4_records; +pub mod log; pub mod nfs; pub mod nfs2; +pub mod nfs2_records; pub mod nfs3; +pub mod nfs3_records; pub mod nfs4; -pub mod log; +pub mod nfs4_records; +pub mod nfs_records; +pub mod rpc_records; +pub mod types; //#[cfg(feature = "lua")] //pub mod lua; diff --git a/rust/src/nfs/nfs.rs b/rust/src/nfs/nfs.rs index dfb5e0e72445..381573b2c476 100644 --- a/rust/src/nfs/nfs.rs +++ b/rust/src/nfs/nfs.rs @@ -26,17 +26,17 @@ use nom7::{Err, Needed}; use crate::applayer; use crate::applayer::*; -use crate::frames::*; -use crate::core::*; use crate::conf::*; -use crate::filetracker::*; +use crate::core::*; use crate::filecontainer::*; +use crate::filetracker::*; +use crate::frames::*; -use crate::nfs::types::*; -use crate::nfs::rpc_records::*; -use crate::nfs::nfs_records::*; use crate::nfs::nfs2_records::*; use crate::nfs::nfs3_records::*; +use crate::nfs::nfs_records::*; +use crate::nfs::rpc_records::*; +use crate::nfs::types::*; pub static mut SURICATA_NFS_FILE_CONFIG: Option<&'static SuricataFileContext> = None; @@ -150,22 +150,31 @@ impl NFSTransactionFile { return Self { file_tracker: FileTransferTracker::new(), ..Default::default() - } + }; } pub fn update_file_flags(&mut self, flow_file_flags: u16) { - let dir_flag = if self.direction == Direction::ToServer { STREAM_TOSERVER } else { STREAM_TOCLIENT }; + let dir_flag = if self.direction == Direction::ToServer { + STREAM_TOSERVER + } else { + STREAM_TOCLIENT + }; self.file_tracker.file_flags = unsafe { FileFlowFlagsToFlags(flow_file_flags, dir_flag) }; } } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_gettxfiles(_state: *mut std::ffi::c_void, tx: *mut std::ffi::c_void, direction: u8) -> AppLayerGetFileState { +pub unsafe extern fn rs_nfs_gettxfiles( + _state: *mut std::ffi::c_void, tx: *mut std::ffi::c_void, direction: u8, +) -> AppLayerGetFileState { let tx = cast_pointer!(tx, NFSTransaction); if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let tx_dir : u8 = tdf.direction.into(); + let tx_dir: u8 = tdf.direction.into(); if direction & tx_dir != 0 { if let Some(sfcm) = { SURICATA_NFS_FILE_CONFIG } { - return AppLayerGetFileState { fc: &mut tdf.file_tracker.file, cfg: sfcm.files_sbcfg } + return AppLayerGetFileState { + fc: &mut tdf.file_tracker.file, + cfg: sfcm.files_sbcfg, + }; } } } @@ -174,8 +183,10 @@ pub unsafe extern "C" fn rs_nfs_gettxfiles(_state: *mut std::ffi::c_void, tx: *m #[derive(Debug)] pub struct NFSTransaction { - pub id: u64, /// internal id - pub xid: u32, /// nfs req/reply pair id + pub id: u64, + /// internal id + pub xid: u32, + /// nfs req/reply pair id pub procedure: u32, /// file name of the object we're dealing with. In case of RENAME /// this is the 'from' or original name. @@ -224,24 +235,24 @@ impl NFSTransaction { id: 0, xid: 0, procedure: 0, - file_name:Vec::new(), - request_machine_name:Vec::new(), - request_uid:0, - request_gid:0, - rpc_response_status:0, - nfs_response_status:0, + file_name: Vec::new(), + request_machine_name: Vec::new(), + request_uid: 0, + request_gid: 0, + rpc_response_status: 0, + nfs_response_status: 0, auth_type: 0, is_first: false, is_last: false, request_done: false, response_done: false, - nfs_version:0, + nfs_version: 0, is_file_tx: false, is_file_closed: false, - file_handle:Vec::new(), + file_handle: Vec::new(), type_data: None, tx_data: AppLayerTxData::new(), - } + }; } pub fn free(&mut self) { @@ -272,10 +283,10 @@ pub struct NFSRequestXidMap { pub progver: u32, pub procedure: u32, pub chunk_offset: u64, - pub file_name:Vec, + pub file_name: Vec, /// READ replies can use this to get to the handle the request used - pub file_handle:Vec, + pub file_handle: Vec, pub gssapi_proc: u32, pub gssapi_service: u32, @@ -287,8 +298,8 @@ impl NFSRequestXidMap { progver, procedure, chunk_offset, - file_name:Vec::new(), - file_handle:Vec::new(), + file_name: Vec::new(), + file_handle: Vec::new(), gssapi_proc: 0, gssapi_service: 0, } @@ -296,31 +307,37 @@ impl NFSRequestXidMap { } /// little wrapper around the FileTransferTracker::new_chunk method -pub fn filetracker_newchunk(ft: &mut FileTransferTracker, name: &[u8], data: &[u8], - chunk_offset: u64, chunk_size: u32, fill_bytes: u8, is_last: bool, xid: &u32) -{ +pub fn filetracker_newchunk( + ft: &mut FileTransferTracker, name: &[u8], data: &[u8], chunk_offset: u64, chunk_size: u32, + fill_bytes: u8, is_last: bool, xid: &u32, +) { if let Some(sfcm) = unsafe { SURICATA_NFS_FILE_CONFIG } { - ft.new_chunk(sfcm, name, data, chunk_offset, - chunk_size, fill_bytes, is_last, xid); + ft.new_chunk( + sfcm, + name, + data, + chunk_offset, + chunk_size, + fill_bytes, + is_last, + xid, + ); } } -fn filetracker_trunc(ft: &mut FileTransferTracker) -{ +fn filetracker_trunc(ft: &mut FileTransferTracker) { if let Some(sfcm) = unsafe { SURICATA_NFS_FILE_CONFIG } { ft.trunc(sfcm); } } -pub fn filetracker_close(ft: &mut FileTransferTracker) -{ +pub fn filetracker_close(ft: &mut FileTransferTracker) { if let Some(sfcm) = unsafe { SURICATA_NFS_FILE_CONFIG } { ft.close(sfcm); } } -fn filetracker_update(ft: &mut FileTransferTracker, data: &[u8], gap_size: u32) -> u32 -{ +fn filetracker_update(ft: &mut FileTransferTracker, data: &[u8], gap_size: u32) -> u32 { if let Some(sfcm) = unsafe { SURICATA_NFS_FILE_CONFIG } { ft.update(sfcm, data, gap_size) } else { @@ -328,7 +345,6 @@ fn filetracker_update(ft: &mut FileTransferTracker, data: &[u8], gap_size: u32) } } - #[derive(Debug)] pub struct NFSState { state_data: AppLayerStateData, @@ -395,23 +411,23 @@ impl NFSState { pub fn new() -> NFSState { NFSState { state_data: AppLayerStateData::new(), - requestmap:HashMap::new(), - namemap:HashMap::new(), + requestmap: HashMap::new(), + namemap: HashMap::new(), transactions: Vec::new(), - ts_chunk_xid:0, - tc_chunk_xid:0, - ts_chunk_left:0, - tc_chunk_left:0, - ts_chunk_fh:Vec::new(), - ts_ssn_gap:false, - tc_ssn_gap:false, - ts_gap:false, - tc_gap:false, - is_udp:false, - check_post_gap_file_txs:false, - post_gap_files_checked:false, - nfs_version:0, - tx_id:0, + ts_chunk_xid: 0, + tc_chunk_xid: 0, + ts_chunk_left: 0, + tc_chunk_left: 0, + ts_chunk_fh: Vec::new(), + ts_ssn_gap: false, + tc_ssn_gap: false, + ts_gap: false, + tc_gap: false, + is_udp: false, + check_post_gap_file_txs: false, + post_gap_files_checked: false, + nfs_version: 0, + tx_id: 0, ts: 0, } } @@ -434,7 +450,9 @@ impl NFSState { tx_old.request_done = true; tx_old.response_done = true; tx_old.is_file_closed = true; - tx_old.tx_data.set_event(NFSEvent::TooManyTransactions as u8); + tx_old + .tx_data + .set_event(NFSEvent::TooManyTransactions as u8); break; } } @@ -497,8 +515,9 @@ impl NFSState { } // TODO maybe not enough users to justify a func - pub fn mark_response_tx_done(&mut self, xid: u32, rpc_status: u32, nfs_status: u32, resp_handle: &Vec) - { + pub fn mark_response_tx_done( + &mut self, xid: u32, rpc_status: u32, nfs_status: u32, resp_handle: &Vec, + ) { if let Some(mytx) = self.get_tx_by_xid(xid) { mytx.response_done = true; mytx.rpc_response_status = rpc_status; @@ -506,108 +525,226 @@ impl NFSState { if mytx.file_handle.is_empty() && !resp_handle.is_empty() { mytx.file_handle = resp_handle.to_vec(); } - - SCLogDebug!("process_reply_record: tx ID {} XID {:04X} REQUEST {} RESPONSE {}", - mytx.id, mytx.xid, mytx.request_done, mytx.response_done); + + SCLogDebug!( + "process_reply_record: tx ID {} XID {:04X} REQUEST {} RESPONSE {}", + mytx.id, + mytx.xid, + mytx.request_done, + mytx.response_done + ); } else { //SCLogNotice!("process_reply_record: not TX found for XID {}", r.hdr.xid); } } - fn add_rpc_udp_ts_pdu(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64) -> Option { - let rpc_udp_ts_pdu = Frame::new(flow, stream_slice, input, rpc_len, NFSFrameType::RPCPdu as u8); + fn add_rpc_udp_ts_pdu( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64, + ) -> Option { + let rpc_udp_ts_pdu = Frame::new( + flow, + stream_slice, + input, + rpc_len, + NFSFrameType::RPCPdu as u8, + ); SCLogDebug!("rpc_udp_pdu ts frame {:?}", rpc_udp_ts_pdu); rpc_udp_ts_pdu } - fn add_rpc_udp_ts_creds(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], creds_len: i64) { - let _rpc_udp_ts_creds = Frame::new(flow, stream_slice, input, creds_len, NFSFrameType::RPCCreds as u8); + fn add_rpc_udp_ts_creds( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], creds_len: i64, + ) { + let _rpc_udp_ts_creds = Frame::new( + flow, + stream_slice, + input, + creds_len, + NFSFrameType::RPCCreds as u8, + ); SCLogDebug!("rpc_creds ts frame {:?}", _rpc_udp_ts_creds); } - fn add_rpc_tcp_ts_pdu(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64) -> Option { - let rpc_tcp_ts_pdu = Frame::new(flow, stream_slice, input, rpc_len, NFSFrameType::RPCPdu as u8); + fn add_rpc_tcp_ts_pdu( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64, + ) -> Option { + let rpc_tcp_ts_pdu = Frame::new( + flow, + stream_slice, + input, + rpc_len, + NFSFrameType::RPCPdu as u8, + ); SCLogDebug!("rpc_tcp_pdu ts frame {:?}", rpc_tcp_ts_pdu); rpc_tcp_ts_pdu } - fn add_rpc_tcp_ts_creds(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], creds_len: i64) { - let _rpc_tcp_ts_creds = Frame::new(flow, stream_slice, input, creds_len, NFSFrameType::RPCCreds as u8); + fn add_rpc_tcp_ts_creds( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], creds_len: i64, + ) { + let _rpc_tcp_ts_creds = Frame::new( + flow, + stream_slice, + input, + creds_len, + NFSFrameType::RPCCreds as u8, + ); SCLogDebug!("rpc_tcp_ts_creds {:?}", _rpc_tcp_ts_creds); } - fn add_nfs_ts_frame(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs_len: i64) { - let _nfs_req_pdu = Frame::new(flow, stream_slice, input, nfs_len, NFSFrameType::NFSPdu as u8); + fn add_nfs_ts_frame( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs_len: i64, + ) { + let _nfs_req_pdu = Frame::new( + flow, + stream_slice, + input, + nfs_len, + NFSFrameType::NFSPdu as u8, + ); SCLogDebug!("nfs_ts_pdu Frame {:?}", _nfs_req_pdu); } - fn add_nfs4_ts_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs4_len: i64) { - let _nfs4_ts_pdu = Frame::new(flow, stream_slice, input, nfs4_len, NFSFrameType::NFS4Pdu as u8); + fn add_nfs4_ts_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs4_len: i64, + ) { + let _nfs4_ts_pdu = Frame::new( + flow, + stream_slice, + input, + nfs4_len, + NFSFrameType::NFS4Pdu as u8, + ); SCLogDebug!("nfs4_ts_pdu Frame: {:?}", _nfs4_ts_pdu); if nfs4_len > 8 { - let _nfs4_ts_hdr = Frame::new(flow, stream_slice, input, 8, NFSFrameType::NFS4Hdr as u8); + let _nfs4_ts_hdr = + Frame::new(flow, stream_slice, input, 8, NFSFrameType::NFS4Hdr as u8); SCLogDebug!("nfs4_ts_hdr Frame {:?}", _nfs4_ts_hdr); - let _nfs4_ts_ops = Frame::new(flow, stream_slice, &input[8..], nfs4_len - 8, NFSFrameType::NFS4Ops as u8); + let _nfs4_ts_ops = Frame::new( + flow, + stream_slice, + &input[8..], + nfs4_len - 8, + NFSFrameType::NFS4Ops as u8, + ); SCLogDebug!("nfs4_ts_ops Frame {:?}", _nfs4_ts_ops); } } - fn add_rpc_udp_tc_pdu(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64) -> Option { - let rpc_udp_tc_pdu = Frame::new(flow, stream_slice, input, rpc_len, NFSFrameType::RPCPdu as u8); + fn add_rpc_udp_tc_pdu( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64, + ) -> Option { + let rpc_udp_tc_pdu = Frame::new( + flow, + stream_slice, + input, + rpc_len, + NFSFrameType::RPCPdu as u8, + ); SCLogDebug!("rpc_tc_pdu frame {:?}", rpc_udp_tc_pdu); rpc_udp_tc_pdu } - fn add_rpc_udp_tc_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64) { + fn add_rpc_udp_tc_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_len: i64, + ) { if rpc_len > 8 { - let _rpc_udp_tc_hdr = Frame::new(flow, stream_slice, input, 8, NFSFrameType::RPCHdr as u8); - let _rpc_udp_tc_data = Frame::new(flow, stream_slice, &input[8..], rpc_len - 8, NFSFrameType::RPCData as u8); + let _rpc_udp_tc_hdr = + Frame::new(flow, stream_slice, input, 8, NFSFrameType::RPCHdr as u8); + let _rpc_udp_tc_data = Frame::new( + flow, + stream_slice, + &input[8..], + rpc_len - 8, + NFSFrameType::RPCData as u8, + ); SCLogDebug!("rpc_udp_tc_hdr frame {:?}", _rpc_udp_tc_hdr); SCLogDebug!("rpc_udp_tc_data frame {:?}", _rpc_udp_tc_data); } } - fn add_rpc_tcp_tc_pdu(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_tcp_len: i64) -> Option { - let rpc_tcp_tc_pdu = Frame::new(flow, stream_slice, input, rpc_tcp_len, NFSFrameType::RPCPdu as u8); + fn add_rpc_tcp_tc_pdu( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_tcp_len: i64, + ) -> Option { + let rpc_tcp_tc_pdu = Frame::new( + flow, + stream_slice, + input, + rpc_tcp_len, + NFSFrameType::RPCPdu as u8, + ); SCLogDebug!("rpc_tcp_pdu tc frame {:?}", rpc_tcp_tc_pdu); rpc_tcp_tc_pdu } - fn add_rpc_tcp_tc_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_tcp_len: i64) { + fn add_rpc_tcp_tc_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], rpc_tcp_len: i64, + ) { if rpc_tcp_len > 12 { - let _rpc_tcp_tc_hdr = Frame::new(flow, stream_slice, input, 12, NFSFrameType::RPCHdr as u8); - let _rpc_tcp_tc_data = Frame::new(flow, stream_slice, &input[12..], rpc_tcp_len - 12, NFSFrameType::RPCData as u8); + let _rpc_tcp_tc_hdr = + Frame::new(flow, stream_slice, input, 12, NFSFrameType::RPCHdr as u8); + let _rpc_tcp_tc_data = Frame::new( + flow, + stream_slice, + &input[12..], + rpc_tcp_len - 12, + NFSFrameType::RPCData as u8, + ); SCLogDebug!("rpc_tcp_tc_hdr frame {:?}", _rpc_tcp_tc_hdr); SCLogDebug!("rpc_tcp_tc_data frame {:?}", _rpc_tcp_tc_data); } } - fn add_nfs_tc_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs_len: i64) { + fn add_nfs_tc_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs_len: i64, + ) { if nfs_len > 0 { - let _nfs_tc_pdu = Frame::new(flow, stream_slice, input, nfs_len, NFSFrameType::NFSPdu as u8); + let _nfs_tc_pdu = Frame::new( + flow, + stream_slice, + input, + nfs_len, + NFSFrameType::NFSPdu as u8, + ); SCLogDebug!("nfs_tc_pdu frame {:?}", _nfs_tc_pdu); - let _nfs_res_status = Frame::new(flow, stream_slice, input, 4, NFSFrameType::NFSStatus as u8); + let _nfs_res_status = + Frame::new(flow, stream_slice, input, 4, NFSFrameType::NFSStatus as u8); SCLogDebug!("nfs_tc_status frame {:?}", _nfs_res_status); } } - fn add_nfs4_tc_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs4_len: i64) { + fn add_nfs4_tc_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nfs4_len: i64, + ) { if nfs4_len > 0 { - let _nfs4_tc_pdu = Frame::new(flow, stream_slice, input, nfs4_len, NFSFrameType::NFS4Pdu as u8); + let _nfs4_tc_pdu = Frame::new( + flow, + stream_slice, + input, + nfs4_len, + NFSFrameType::NFS4Pdu as u8, + ); SCLogDebug!("nfs4_tc_pdu frame {:?}", _nfs4_tc_pdu); - let _nfs4_tc_status = Frame::new(flow, stream_slice, input, 4, NFSFrameType::NFS4Status as u8); + let _nfs4_tc_status = + Frame::new(flow, stream_slice, input, 4, NFSFrameType::NFS4Status as u8); SCLogDebug!("nfs4_tc_status frame {:?}", _nfs4_tc_status); } if nfs4_len > 8 { - let _nfs4_tc_hdr = Frame::new(flow, stream_slice, input, 8, NFSFrameType::NFS4Hdr as u8); + let _nfs4_tc_hdr = + Frame::new(flow, stream_slice, input, 8, NFSFrameType::NFS4Hdr as u8); SCLogDebug!("nfs4_tc_hdr frame {:?}", _nfs4_tc_hdr); - let _nfs4_tc_ops = Frame::new(flow, stream_slice, &input[8..], nfs4_len - 8, NFSFrameType::NFS4Ops as u8); + let _nfs4_tc_ops = Frame::new( + flow, + stream_slice, + &input[8..], + nfs4_len - 8, + NFSFrameType::NFS4Ops as u8, + ); SCLogDebug!("nfs4_tc_ops frame {:?}", _nfs4_tc_ops); } } - fn post_gap_housekeeping_for_files(&mut self) - { + fn post_gap_housekeeping_for_files(&mut self) { let mut post_gap_txs = false; for tx in &mut self.transactions { if let Some(NFSTransactionTypeData::FILE(ref mut f)) = tx.type_data { @@ -630,8 +767,7 @@ impl NFSState { * can handle gaps. For the file transactions we set the current * (flow) time and prune them in 60 seconds if no update for them * was received. */ - fn post_gap_housekeeping(&mut self, dir: Direction) - { + fn post_gap_housekeeping(&mut self, dir: Direction) { if self.ts_ssn_gap && dir == Direction::ToServer { for tx in &mut self.transactions { if tx.id >= self.tx_id { @@ -677,10 +813,10 @@ impl NFSState { Ok((_, lookup)) => { SCLogDebug!("LOOKUP {:?}", lookup); xidmap.file_name = lookup.name_vec; - }, + } _ => { self.set_event(NFSEvent::MalformedData); - }, + } }; } @@ -689,39 +825,48 @@ impl NFSState { Some(n) => { SCLogDebug!("xidmap_handle2name: name {:?}", n); xidmap.file_name = n.to_vec(); - }, + } _ => { - SCLogDebug!("xidmap_handle2name: object {:?} not found", - xidmap.file_handle); - }, + SCLogDebug!( + "xidmap_handle2name: object {:?} not found", + xidmap.file_handle + ); + } } } /// complete request record - fn process_request_record(&mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcPacket) { - SCLogDebug!("REQUEST {} procedure {} ({}) blob size {}", - r.hdr.xid, r.procedure, self.requestmap.len(), r.prog_data.len()); + fn process_request_record( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcPacket, + ) { + SCLogDebug!( + "REQUEST {} procedure {} ({}) blob size {}", + r.hdr.xid, + r.procedure, + self.requestmap.len(), + r.prog_data.len() + ); match r.progver { 4 => { self.add_nfs4_ts_frames(flow, stream_slice, r.prog_data, r.prog_data_size as i64); self.process_request_record_v4(r) - }, + } 3 => { self.add_nfs_ts_frame(flow, stream_slice, r.prog_data, r.prog_data_size as i64); self.process_request_record_v3(r) - }, + } 2 => { self.add_nfs_ts_frame(flow, stream_slice, r.prog_data, r.prog_data_size as i64); self.process_request_record_v2(r) - }, - _ => { }, + } + _ => {} } } - pub fn new_file_tx(&mut self, file_handle: &[u8], file_name: &[u8], direction: Direction) - -> &mut NFSTransaction - { + pub fn new_file_tx( + &mut self, file_handle: &[u8], file_name: &[u8], direction: Direction, + ) -> &mut NFSTransaction { let mut tx = self.new_tx(); tx.file_name = file_name.to_vec(); tx.file_handle = file_handle.to_vec(); @@ -735,23 +880,31 @@ impl NFSState { d.update_file_flags(tx.tx_data.file_flags); } tx.tx_data.init_files_opened(); - tx.tx_data.file_tx = if direction == Direction::ToServer { STREAM_TOSERVER } else { STREAM_TOCLIENT }; // TODO direction to flag func? - SCLogDebug!("new_file_tx: TX FILE created: ID {} NAME {}", - tx.id, String::from_utf8_lossy(file_name)); + tx.tx_data.file_tx = if direction == Direction::ToServer { + STREAM_TOSERVER + } else { + STREAM_TOCLIENT + }; // TODO direction to flag func? + SCLogDebug!( + "new_file_tx: TX FILE created: ID {} NAME {}", + tx.id, + String::from_utf8_lossy(file_name) + ); self.transactions.push(tx); let tx_ref = self.transactions.last_mut(); return tx_ref.unwrap(); } - pub fn get_file_tx_by_handle(&mut self, file_handle: &[u8], direction: Direction) - -> Option<&mut NFSTransaction> - { + pub fn get_file_tx_by_handle( + &mut self, file_handle: &[u8], direction: Direction, + ) -> Option<&mut NFSTransaction> { let fh = file_handle.to_vec(); for tx in &mut self.transactions { if let Some(NFSTransactionTypeData::FILE(ref mut d)) = tx.type_data { - if tx.is_file_tx && !tx.is_file_closed && - direction == d.direction && - tx.file_handle == fh + if tx.is_file_tx + && !tx.is_file_closed + && direction == d.direction + && tx.file_handle == fh { tx.tx_data.update_file_flags(self.state_data.file_flags); d.update_file_flags(tx.tx_data.file_flags); @@ -790,9 +943,16 @@ impl NFSState { let found = match self.get_file_tx_by_handle(&file_handle, Direction::ToServer) { Some(tx) => { if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, w.file_data, w.offset, - w.file_len, fill_bytes as u8, is_last, &r.hdr.xid); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + w.file_data, + w.offset, + w.file_len, + fill_bytes as u8, + is_last, + &r.hdr.xid, + ); tdf.chunk_count += 1; if is_last { tdf.file_last_xid = r.hdr.xid; @@ -804,15 +964,22 @@ impl NFSState { } else { false } - }, - None => { false }, + } + None => false, }; if !found { let tx = self.new_file_tx(&file_handle, &file_name, Direction::ToServer); if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, w.file_data, w.offset, - w.file_len, fill_bytes as u8, is_last, &r.hdr.xid); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + w.file_data, + w.offset, + w.file_len, + fill_bytes as u8, + is_last, + &r.hdr.xid, + ); tx.procedure = NFSPROC3_WRITE; tx.xid = r.hdr.xid; tx.is_first = true; @@ -830,13 +997,24 @@ impl NFSState { debug_validate_bug_on!(w.file_data.len() as u32 > w.count); self.ts_chunk_left = w.count - w.file_data.len() as u32; self.ts_chunk_fh = file_handle; - SCLogDebug!("REQUEST chunk_xid {:04X} chunk_left {}", self.ts_chunk_xid, self.ts_chunk_left); + SCLogDebug!( + "REQUEST chunk_xid {:04X} chunk_left {}", + self.ts_chunk_xid, + self.ts_chunk_left + ); } 0 } - fn process_partial_write_request_record<'b>(&mut self, r: &RpcPacket<'b>, w: &Nfs3RequestWrite<'b>) -> u32 { - SCLogDebug!("REQUEST {} procedure {} blob size {}", r.hdr.xid, r.procedure, r.prog_data.len()); + fn process_partial_write_request_record<'b>( + &mut self, r: &RpcPacket<'b>, w: &Nfs3RequestWrite<'b>, + ) -> u32 { + SCLogDebug!( + "REQUEST {} procedure {} blob size {}", + r.hdr.xid, + r.procedure, + r.prog_data.len() + ); let mut xidmap = NFSRequestXidMap::new(r.progver, r.procedure, 0); xidmap.file_handle = w.handle.value.to_vec(); @@ -845,21 +1023,31 @@ impl NFSState { return self.process_write_record(r, w); } - fn process_reply_record(&mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcReplyPacket) -> u32 { + fn process_reply_record( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcReplyPacket, + ) -> u32 { let mut xidmap; match self.requestmap.remove(&r.hdr.xid) { - Some(p) => { xidmap = p; }, + Some(p) => { + xidmap = p; + } _ => { - SCLogDebug!("REPLY: xid {:04X} NOT FOUND. GAPS? TS:{} TC:{}", - r.hdr.xid, self.ts_ssn_gap, self.tc_ssn_gap); + SCLogDebug!( + "REPLY: xid {:04X} NOT FOUND. GAPS? TS:{} TC:{}", + r.hdr.xid, + self.ts_ssn_gap, + self.tc_ssn_gap + ); // TODO we might be able to try to infer from the size + data // that this is a READ reply and pass the data to the file API anyway? return 0; - }, + } } - SCLogDebug!("process_reply_record: removed xid {:04X} from requestmap", - r.hdr.xid); + SCLogDebug!( + "process_reply_record: removed xid {:04X} from requestmap", + r.hdr.xid + ); if self.nfs_version == 0 { self.nfs_version = xidmap.progver as u16; @@ -871,24 +1059,24 @@ impl NFSState { self.add_nfs_tc_frames(flow, stream_slice, r.prog_data, r.prog_data_size as i64); self.process_reply_record_v2(r, &xidmap); return 0; - }, + } 3 => { SCLogDebug!("NFSv3 reply record"); self.add_nfs_tc_frames(flow, stream_slice, r.prog_data, r.prog_data_size as i64); self.process_reply_record_v3(r, &mut xidmap); return 0; - }, + } 4 => { SCLogDebug!("NFSv4 reply record"); self.add_nfs4_tc_frames(flow, stream_slice, r.prog_data, r.prog_data_size as i64); self.process_reply_record_v4(r, &mut xidmap); return 0; - }, + } _ => { SCLogDebug!("Invalid NFS version"); self.set_event(NFSEvent::NonExistingVersion); return 0; - }, + } } } @@ -901,14 +1089,19 @@ impl NFSState { self.tc_chunk_left }; if chunk_left == 0 { - return 0 + return 0; } let xid = if direction == Direction::ToServer { self.ts_chunk_xid } else { self.tc_chunk_xid }; - SCLogDebug!("filetracker_update: chunk left {}, input {} chunk_xid {:04X}", chunk_left, data.len(), xid); + SCLogDebug!( + "filetracker_update: chunk left {}, input {} chunk_xid {:04X}", + chunk_left, + data.len(), + xid + ); let file_handle; // we have the data that we expect @@ -926,11 +1119,11 @@ impl NFSState { match self.requestmap.remove(&xid) { None => { SCLogDebug!("no file handle found for XID {:04X}", xid); - return 0 - }, + return 0; + } Some(xidmap) => { file_handle = xidmap.file_handle.to_vec(); - }, + } } } } else { @@ -943,11 +1136,11 @@ impl NFSState { match self.requestmap.get(&xid) { None => { SCLogDebug!("no file handle found for XID {:04X}", xid); - return 0 - }, + return 0; + } Some(xidmap) => { file_handle = xidmap.file_handle.to_vec(); - }, + } } } } @@ -965,8 +1158,12 @@ impl NFSState { if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { if ssn_gap { let queued_data = tdf.file_tracker.get_queued_size(); - if queued_data > 2000000 { // TODO should probably be configurable - SCLogDebug!("QUEUED size {} while we've seen GAPs. Truncating file.", queued_data); + if queued_data > 2000000 { + // TODO should probably be configurable + SCLogDebug!( + "QUEUED size {} while we've seen GAPs. Truncating file.", + queued_data + ); filetracker_trunc(&mut tdf.file_tracker); } } @@ -983,28 +1180,35 @@ impl NFSState { if direction == Direction::ToClient { tx.response_done = true; tx.is_file_closed = true; - SCLogDebug!("TX {} response is done now that the file track is ready", tx.id); + SCLogDebug!( + "TX {} response is done now that the file track is ready", + tx.id + ); } else { tx.request_done = true; tx.is_file_closed = true; - SCLogDebug!("TX {} request is done now that the file track is ready", tx.id); + SCLogDebug!( + "TX {} request is done now that the file track is ready", + tx.id + ); } } cs } else { 0 } - }, - None => { 0 }, + } + None => 0, }; return consumed; } /// xidmapr is an Option as it's already removed from the map if we /// have a complete record. Otherwise we do a lookup ourselves. - pub fn process_read_record<'b>(&mut self, r: &RpcReplyPacket<'b>, - reply: &NfsReplyRead<'b>, xidmapr: Option<&NFSRequestXidMap>) -> u32 - { + pub fn process_read_record<'b>( + &mut self, r: &RpcReplyPacket<'b>, reply: &NfsReplyRead<'b>, + xidmapr: Option<&NFSRequestXidMap>, + ) -> u32 { let file_name; let file_handle; let chunk_offset; @@ -1027,7 +1231,7 @@ impl NFSState { file_handle = xidmap.file_handle.to_vec(); chunk_offset = xidmap.chunk_offset; nfs_version = xidmap.progver; - }, + } None => { if let Some(xidmap) = self.requestmap.get(&r.hdr.xid) { file_name = xidmap.file_name.to_vec(); @@ -1037,26 +1241,37 @@ impl NFSState { } else { return 0; } - }, + } } SCLogDebug!("chunk_offset {}", chunk_offset); let mut is_last = reply.eof; - SCLogDebug!("XID {} is_last {} fill_bytes {} reply.count {} reply.data_len {} reply.data.len() {}", - r.hdr.xid, is_last, fill_bytes, reply.count, reply.data_len, reply.data.len()); + SCLogDebug!( + "XID {} is_last {} fill_bytes {} reply.count {} reply.data_len {} reply.data.len() {}", + r.hdr.xid, + is_last, + fill_bytes, + reply.count, + reply.data_len, + reply.data.len() + ); if nfs_version == 2 { let size = match parse_nfs2_attribs(reply.attr_blob) { Ok((_, ref attr)) => attr.asize, _ => 0, }; - SCLogDebug!("NFSv2 READ reply record: File size {}. Offset {} data len {}: total {}", - size, chunk_offset, reply.data_len, chunk_offset + reply.data_len as u64); + SCLogDebug!( + "NFSv2 READ reply record: File size {}. Offset {} data len {}: total {}", + size, + chunk_offset, + reply.data_len, + chunk_offset + reply.data_len as u64 + ); if size as u64 == chunk_offset + reply.data_len as u64 { is_last = true; } - } let is_partial = reply.data.len() < reply.count as usize; @@ -1066,9 +1281,16 @@ impl NFSState { Some(tx) => { SCLogDebug!("updated TX {:?}", tx); if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, reply.data, chunk_offset, - reply.count, fill_bytes as u8, is_last, &r.hdr.xid); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + reply.data, + chunk_offset, + reply.count, + fill_bytes as u8, + is_last, + &r.hdr.xid, + ); tdf.chunk_count += 1; if is_last { tdf.file_last_xid = r.hdr.xid; @@ -1088,16 +1310,27 @@ impl NFSState { } else { false } - }, - None => { false }, + } + None => false, }; if !found { let tx = self.new_file_tx(&file_handle, &file_name, Direction::ToClient); if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, reply.data, chunk_offset, - reply.count, fill_bytes as u8, is_last, &r.hdr.xid); - tx.procedure = if nfs_version < 4 { NFSPROC3_READ } else { NFSPROC4_READ }; + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + reply.data, + chunk_offset, + reply.count, + fill_bytes as u8, + is_last, + &r.hdr.xid, + ); + tx.procedure = if nfs_version < 4 { + NFSPROC3_READ + } else { + NFSPROC4_READ + }; tx.xid = r.hdr.xid; tx.is_first = true; if is_last { @@ -1123,15 +1356,27 @@ impl NFSState { self.tc_chunk_left = reply.count - reply.data.len() as u32; } - SCLogDebug!("REPLY {} to procedure {} blob size {} / {}: chunk_left {} chunk_xid {:04X}", - r.hdr.xid, NFSPROC3_READ, r.prog_data.len(), reply.count, self.tc_chunk_left, - self.tc_chunk_xid); + SCLogDebug!( + "REPLY {} to procedure {} blob size {} / {}: chunk_left {} chunk_xid {:04X}", + r.hdr.xid, + NFSPROC3_READ, + r.prog_data.len(), + reply.count, + self.tc_chunk_left, + self.tc_chunk_xid + ); 0 } - fn process_partial_read_reply_record<'b>(&mut self, r: &RpcReplyPacket<'b>, reply: &NfsReplyRead<'b>) -> u32 { - SCLogDebug!("REPLY {} to procedure READ blob size {} / {}", - r.hdr.xid, r.prog_data.len(), reply.count); + fn process_partial_read_reply_record<'b>( + &mut self, r: &RpcReplyPacket<'b>, reply: &NfsReplyRead<'b>, + ) -> u32 { + SCLogDebug!( + "REPLY {} to procedure READ blob size {} / {}", + r.hdr.xid, + r.prog_data.len(), + reply.count + ); return self.process_read_record(r, reply, None); } @@ -1174,8 +1419,10 @@ impl NFSState { } /// Handle partial records - fn parse_tcp_partial_data_ts<'b>(&mut self, base_input: &'b[u8], cur_i: &'b[u8], - phdr: &RpcRequestPacketPartial, rec_size: usize) -> AppLayerResult { + fn parse_tcp_partial_data_ts<'b>( + &mut self, base_input: &'b [u8], cur_i: &'b [u8], phdr: &RpcRequestPacketPartial, + rec_size: usize, + ) -> AppLayerResult { // special case: avoid buffering file write blobs // as these can be large. if rec_size >= 512 && cur_i.len() >= 44 { @@ -1184,7 +1431,10 @@ impl NFSState { // quick peek, are we in WRITE mode? if phdr.procedure == NFSPROC3_WRITE { - SCLogDebug!("CONFIRMED WRITE: large record {}, file chunk xfer", rec_size); + SCLogDebug!( + "CONFIRMED WRITE: large record {}, file chunk xfer", + rec_size + ); // lets try to parse the RPC record. Might fail with Incomplete. match parse_rpc(cur_i, false) { @@ -1230,7 +1480,9 @@ impl NFSState { } /// Parsing function, handling TCP chunks fragmentation - pub fn parse_tcp_data_ts(&mut self, flow: *const Flow, stream_slice: &StreamSlice) -> AppLayerResult { + pub fn parse_tcp_data_ts( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, + ) -> AppLayerResult { let mut cur_i = stream_slice.as_slice(); // take care of in progress file chunk transfers // and skip buffer beyond it @@ -1255,27 +1507,34 @@ impl NFSState { SCLogDebug!("expected data found"); self.ts_gap = false; break; - }, + } 0 => { SCLogDebug!("incomplete, queue and retry with the next block (input {}). Looped {} times.", cur_i.len(), _cnt); - return AppLayerResult::incomplete(stream_slice.len() - cur_i.len() as u32, (cur_i.len() + 1) as u32); - }, + return AppLayerResult::incomplete( + stream_slice.len() - cur_i.len() as u32, + (cur_i.len() + 1) as u32, + ); + } -1 => { cur_i = &cur_i[1..]; if cur_i.is_empty() { - SCLogDebug!("all post-GAP data in this chunk was bad. Looped {} times.", _cnt); + SCLogDebug!( + "all post-GAP data in this chunk was bad. Looped {} times.", + _cnt + ); } - }, + } _ => { return AppLayerResult::err(); - }, + } } } SCLogDebug!("TS GAP handling done (input {})", cur_i.len()); } - while !cur_i.is_empty() { // min record size + while !cur_i.is_empty() { + // min record size self.add_rpc_tcp_ts_pdu(flow, stream_slice, cur_i, cur_i.len() as i64); match parse_rpc_request_partial(cur_i) { Ok((_, ref rpc_phdr)) => { @@ -1283,7 +1542,12 @@ impl NFSState { // Handle partial records if rec_size > cur_i.len() { - return self.parse_tcp_partial_data_ts(stream_slice.as_slice(), cur_i, rpc_phdr, rec_size); + return self.parse_tcp_partial_data_ts( + stream_slice.as_slice(), + cur_i, + rpc_phdr, + rec_size, + ); } // we have the full records size worth of data, @@ -1292,14 +1556,18 @@ impl NFSState { // go to the next record. match parse_rpc(cur_i, true) { Ok((_, ref rpc_record)) => { - self.add_rpc_tcp_ts_creds(flow, stream_slice, &cur_i[RPC_TCP_PRE_CREDS..], (rpc_record.creds_len + 8) as i64); + self.add_rpc_tcp_ts_creds( + flow, + stream_slice, + &cur_i[RPC_TCP_PRE_CREDS..], + (rpc_record.creds_len + 8) as i64, + ); self.process_request_record(flow, stream_slice, rpc_record); } Err(Err::Incomplete(_)) => { self.set_event(NFSEvent::MalformedData); } - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { self.set_event(NFSEvent::MalformedData); SCLogDebug!("Parsing failed: {:?}", _e); } @@ -1313,20 +1581,22 @@ impl NFSState { // looks for. let n = usize::from(n); let need = if n > 28 { n } else { 28 }; - return AppLayerResult::incomplete(stream_slice.len() - cur_i.len() as u32, need as u32); + return AppLayerResult::incomplete( + stream_slice.len() - cur_i.len() as u32, + need as u32, + ); } return AppLayerResult::err(); } /* This error is fatal. If we failed to parse the RPC hdr we don't * have a length and we don't know where the next record starts. */ - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { self.set_event(NFSEvent::MalformedData); SCLogDebug!("Parsing failed: {:?}", _e); return AppLayerResult::err(); } } - }; + } self.post_gap_housekeeping(Direction::ToServer); if self.check_post_gap_file_txs && !self.post_gap_files_checked { @@ -1338,17 +1608,22 @@ impl NFSState { } /// Handle partial records - fn parse_tcp_partial_data_tc<'b>(&mut self, base_input: &'b[u8], cur_i: &'b[u8], - phdr: &RpcPacketHeader, rec_size: usize) -> AppLayerResult { + fn parse_tcp_partial_data_tc<'b>( + &mut self, base_input: &'b [u8], cur_i: &'b [u8], phdr: &RpcPacketHeader, rec_size: usize, + ) -> AppLayerResult { // special case: avoid buffering file read blobs // as these can be large. - if rec_size >= 512 && cur_i.len() >= 128 {//36 { + if rec_size >= 512 && cur_i.len() >= 128 { + //36 { // large record, likely file xfer SCLogDebug!("large record {}, likely file xfer", rec_size); // quick peek, are in READ mode? if self.peek_reply_record(phdr) == NFSPROC3_READ { - SCLogDebug!("CONFIRMED large READ record {}, likely file chunk xfer", rec_size); + SCLogDebug!( + "CONFIRMED large READ record {}, likely file chunk xfer", + rec_size + ); // we should have enough data to parse the RPC record match parse_rpc_reply(cur_i, false) { @@ -1394,7 +1669,9 @@ impl NFSState { } /// Parsing function, handling TCP chunks fragmentation - pub fn parse_tcp_data_tc(&mut self, flow: *const Flow, stream_slice: &StreamSlice) -> AppLayerResult { + pub fn parse_tcp_data_tc( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, + ) -> AppLayerResult { let mut cur_i = stream_slice.as_slice(); // take care of in progress file chunk transfers // and skip buffer beyond it @@ -1419,18 +1696,24 @@ impl NFSState { SCLogDebug!("expected data found"); self.tc_gap = false; break; - }, + } 0 => { SCLogDebug!("incomplete, queue and retry with the next block (input {}). Looped {} times.", cur_i.len(), _cnt); - return AppLayerResult::incomplete(stream_slice.len() - cur_i.len() as u32, (cur_i.len() + 1) as u32); - }, + return AppLayerResult::incomplete( + stream_slice.len() - cur_i.len() as u32, + (cur_i.len() + 1) as u32, + ); + } -1 => { cur_i = &cur_i[1..]; if cur_i.is_empty() { - SCLogDebug!("all post-GAP data in this chunk was bad. Looped {} times.", _cnt); + SCLogDebug!( + "all post-GAP data in this chunk was bad. Looped {} times.", + _cnt + ); } - }, + } _ => { return AppLayerResult::err(); } @@ -1446,13 +1729,23 @@ impl NFSState { let rec_size = (rpc_phdr.frag_len + 4) as usize; // see if we have all data available if rec_size > cur_i.len() { - return self.parse_tcp_partial_data_tc(stream_slice.as_slice(), cur_i, rpc_phdr, rec_size); + return self.parse_tcp_partial_data_tc( + stream_slice.as_slice(), + cur_i, + rpc_phdr, + rec_size, + ); } // we have the full data of the record, lets parse match parse_rpc_reply(cur_i, true) { Ok((_, ref rpc_record)) => { - self.add_rpc_tcp_tc_frames(flow, stream_slice, cur_i, cur_i.len() as i64); + self.add_rpc_tcp_tc_frames( + flow, + stream_slice, + cur_i, + cur_i.len() as i64, + ); self.process_reply_record(flow, stream_slice, rpc_record); } Err(Err::Incomplete(_)) => { @@ -1461,8 +1754,7 @@ impl NFSState { // bad. self.set_event(NFSEvent::MalformedData); } - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { self.set_event(NFSEvent::MalformedData); SCLogDebug!("Parsing failed: {:?}", _e); } @@ -1476,20 +1768,22 @@ impl NFSState { // looks for. let n = usize::from(n); let need = if n > 12 { n } else { 12 }; - return AppLayerResult::incomplete(stream_slice.len() - cur_i.len() as u32, need as u32); + return AppLayerResult::incomplete( + stream_slice.len() - cur_i.len() as u32, + need as u32, + ); } return AppLayerResult::err(); } /* This error is fatal. If we failed to parse the RPC hdr we don't * have a length and we don't know where the next record starts. */ - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { self.set_event(NFSEvent::MalformedData); SCLogDebug!("Parsing failed: {:?}", _e); return AppLayerResult::err(); } } - }; + } self.post_gap_housekeeping(Direction::ToClient); if self.check_post_gap_file_txs && !self.post_gap_files_checked { self.post_gap_housekeeping_for_files(); @@ -1498,7 +1792,9 @@ impl NFSState { AppLayerResult::ok() } /// Parsing function - pub fn parse_udp_ts(&mut self, flow: *const Flow, stream_slice: &StreamSlice) -> AppLayerResult { + pub fn parse_udp_ts( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, + ) -> AppLayerResult { let input = stream_slice.as_slice(); SCLogDebug!("parse_udp_ts ({})", input.len()); self.add_rpc_udp_ts_pdu(flow, stream_slice, input, input.len() as i64); @@ -1506,22 +1802,30 @@ impl NFSState { match parse_rpc_udp_request(input) { Ok((_, ref rpc_record)) => { self.is_udp = true; - self.add_rpc_udp_ts_creds(flow, stream_slice, &input[RPC_UDP_PRE_CREDS..], (rpc_record.creds_len + 8) as i64); + self.add_rpc_udp_ts_creds( + flow, + stream_slice, + &input[RPC_UDP_PRE_CREDS..], + (rpc_record.creds_len + 8) as i64, + ); match rpc_record.progver { 3 => { self.process_request_record(flow, stream_slice, rpc_record); - }, + } 2 => { - self.add_nfs_ts_frame(flow, stream_slice, rpc_record.prog_data, rpc_record.prog_data_size as i64); + self.add_nfs_ts_frame( + flow, + stream_slice, + rpc_record.prog_data, + rpc_record.prog_data_size as i64, + ); self.process_request_record_v2(rpc_record); - }, - _ => { }, + } + _ => {} } - }, - Err(Err::Incomplete(_)) => { - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + } + Err(Err::Incomplete(_)) => {} + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { SCLogDebug!("Parsing failed: {:?}", _e); } } @@ -1530,7 +1834,9 @@ impl NFSState { } /// Parsing function - pub fn parse_udp_tc(&mut self, flow: *const Flow, stream_slice: &StreamSlice) -> AppLayerResult { + pub fn parse_udp_tc( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, + ) -> AppLayerResult { let input = stream_slice.as_slice(); SCLogDebug!("parse_udp_tc ({})", input.len()); self.add_rpc_udp_tc_pdu(flow, stream_slice, input, input.len() as i64); @@ -1540,11 +1846,9 @@ impl NFSState { self.is_udp = true; self.add_rpc_udp_tc_frames(flow, stream_slice, input, input.len() as i64); self.process_reply_record(flow, stream_slice, rpc_record); - }, - Err(Err::Incomplete(_)) => { - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + } + Err(Err::Incomplete(_)) => {} + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { SCLogDebug!("Parsing failed: {:?}", _e); } } @@ -1555,7 +1859,9 @@ impl NFSState { /// Returns *mut NFSState #[no_mangle] -pub extern "C" fn rs_nfs_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_nfs_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = NFSState::new(); let boxed = Box::new(state); SCLogDebug!("allocating state"); @@ -1565,7 +1871,7 @@ pub extern "C" fn rs_nfs_state_new(_orig_state: *mut std::os::raw::c_void, _orig /// Params: /// - state: *mut NFSState as void pointer #[no_mangle] -pub extern "C" fn rs_nfs_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_nfs_state_free(state: *mut std::os::raw::c_void) { // Just unbox... SCLogDebug!("freeing state"); std::mem::drop(unsafe { Box::from_raw(state as *mut NFSState) }); @@ -1573,13 +1879,10 @@ pub extern "C" fn rs_nfs_state_free(state: *mut std::os::raw::c_void) { /// C binding parse a NFS TCP request. Returns 1 on success, -1 on failure. #[no_mangle] -pub unsafe extern "C" fn rs_nfs_parse_request(flow: *const Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult -{ +pub unsafe extern fn rs_nfs_parse_request( + flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let state = cast_pointer!(state, NFSState); let flow = cast_pointer!(flow, Flow); @@ -1593,22 +1896,15 @@ pub unsafe extern "C" fn rs_nfs_parse_request(flow: *const Flow, } #[no_mangle] -pub extern "C" fn rs_nfs_parse_request_tcp_gap( - state: &mut NFSState, - input_len: u32) - -> AppLayerResult -{ +pub extern fn rs_nfs_parse_request_tcp_gap(state: &mut NFSState, input_len: u32) -> AppLayerResult { state.parse_tcp_data_ts_gap(input_len) } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_parse_response(flow: *const Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult -{ +pub unsafe extern fn rs_nfs_parse_response( + flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let state = cast_pointer!(state, NFSState); let flow = cast_pointer!(flow, Flow); @@ -1622,23 +1918,18 @@ pub unsafe extern "C" fn rs_nfs_parse_response(flow: *const Flow, } #[no_mangle] -pub extern "C" fn rs_nfs_parse_response_tcp_gap( - state: &mut NFSState, - input_len: u32) - -> AppLayerResult -{ +pub extern fn rs_nfs_parse_response_tcp_gap( + state: &mut NFSState, input_len: u32, +) -> AppLayerResult { state.parse_tcp_data_tc_gap(input_len) } /// C binding to parse an NFS/UDP request. Returns 1 on success, -1 on failure. #[no_mangle] -pub unsafe extern "C" fn rs_nfs_parse_request_udp(f: *const Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult -{ +pub unsafe extern fn rs_nfs_parse_request_udp( + f: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let state = cast_pointer!(state, NFSState); SCLogDebug!("parsing {} bytes of request data", stream_slice.len()); @@ -1646,32 +1937,26 @@ pub unsafe extern "C" fn rs_nfs_parse_request_udp(f: *const Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_parse_response_udp(f: *const Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult -{ +pub unsafe extern fn rs_nfs_parse_response_udp( + f: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let state = cast_pointer!(state, NFSState); SCLogDebug!("parsing {} bytes of response data", stream_slice.len()); state.parse_udp_tc(f, &stream_slice) } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_state_get_tx_count(state: *mut std::os::raw::c_void) - -> u64 -{ +pub unsafe extern fn rs_nfs_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, NFSState); SCLogDebug!("rs_nfs_state_get_tx_count: returning {}", state.tx_id); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_state_get_tx(state: *mut std::os::raw::c_void, - tx_id: u64) - -> *mut std::os::raw::c_void -{ +pub unsafe extern fn rs_nfs_state_get_tx( + state: *mut std::os::raw::c_void, tx_id: u64, +) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, NFSState); match state.get_tx_by_id(tx_id) { Some(tx) => { @@ -1684,18 +1969,15 @@ pub unsafe extern "C" fn rs_nfs_state_get_tx(state: *mut std::os::raw::c_void, } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_state_tx_free(state: *mut std::os::raw::c_void, - tx_id: u64) -{ +pub unsafe extern fn rs_nfs_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, NFSState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_tx_get_alstate_progress(tx: *mut std::os::raw::c_void, - direction: u8) - -> std::os::raw::c_int -{ +pub unsafe extern fn rs_nfs_tx_get_alstate_progress( + tx: *mut std::os::raw::c_void, direction: u8, +) -> std::os::raw::c_int { let tx = cast_pointer!(tx, NFSTransaction); if direction == Direction::ToServer.into() && tx.request_done { SCLogDebug!("TOSERVER progress 1"); @@ -1710,10 +1992,7 @@ pub unsafe extern "C" fn rs_nfs_tx_get_alstate_progress(tx: *mut std::os::raw::c } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_get_tx_data( - tx: *mut std::os::raw::c_void) - -> *mut AppLayerTxData -{ +pub unsafe extern fn rs_nfs_get_tx_data(tx: *mut std::os::raw::c_void) -> *mut AppLayerTxData { let tx = cast_pointer!(tx, NFSTransaction); return &mut tx.tx_data; } @@ -1724,11 +2003,9 @@ export_state_data_get!(rs_nfs_get_state_data, NFSState); /// otherwise get procs from the 'file_additional_procs'. /// Keep calling until 0 is returned. #[no_mangle] -pub unsafe extern "C" fn rs_nfs_tx_get_procedures(tx: &mut NFSTransaction, - i: u16, - procedure: *mut u32) - -> u8 -{ +pub unsafe extern fn rs_nfs_tx_get_procedures( + tx: &mut NFSTransaction, i: u16, procedure: *mut u32, +) -> u8 { if i == 0 { *procedure = tx.procedure; return 1; @@ -1752,15 +2029,12 @@ pub unsafe extern "C" fn rs_nfs_tx_get_procedures(tx: &mut NFSTransaction, } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_tx_get_version(tx: &mut NFSTransaction, - version: *mut u32) -{ +pub unsafe extern fn rs_nfs_tx_get_version(tx: &mut NFSTransaction, version: *mut u32) { *version = tx.nfs_version as u32; } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_init(context: &'static mut SuricataFileContext) -{ +pub unsafe extern fn rs_nfs_init(context: &'static mut SuricataFileContext) { SURICATA_NFS_FILE_CONFIG = Some(context); } @@ -1774,13 +2048,13 @@ fn nfs_probe_dir(i: &[u8], rdir: *mut u8) -> i8 { }; unsafe { *rdir = dir as u8 }; return 1; - }, + } Err(Err::Incomplete(_)) => { return 0; - }, + } Err(_) => { return -1; - }, + } } } @@ -1788,54 +2062,73 @@ pub fn nfs_probe(i: &[u8], direction: Direction) -> i32 { if direction == Direction::ToClient { match parse_rpc_reply(i, false) { Ok((_, ref rpc)) => { - if rpc.hdr.frag_len >= 24 && rpc.hdr.frag_len <= 35000 && rpc.hdr.msgtype == 1 && rpc.reply_state == 0 && rpc.accept_state == 0 { - SCLogDebug!("TC PROBE LEN {} XID {} TYPE {}", rpc.hdr.frag_len, rpc.hdr.xid, rpc.hdr.msgtype); + if rpc.hdr.frag_len >= 24 + && rpc.hdr.frag_len <= 35000 + && rpc.hdr.msgtype == 1 + && rpc.reply_state == 0 + && rpc.accept_state == 0 + { + SCLogDebug!( + "TC PROBE LEN {} XID {} TYPE {}", + rpc.hdr.frag_len, + rpc.hdr.xid, + rpc.hdr.msgtype + ); return 1; } else { return -1; } - }, - Err(Err::Incomplete(_)) => { - match parse_rpc_packet_header (i) { - Ok((_, ref rpc_hdr)) => { - if rpc_hdr.frag_len >= 24 && rpc_hdr.frag_len <= 35000 && rpc_hdr.xid != 0 && rpc_hdr.msgtype == 1 { - SCLogDebug!("TC PROBE LEN {} XID {} TYPE {}", rpc_hdr.frag_len, rpc_hdr.xid, rpc_hdr.msgtype); - return 1; - } else { - return -1; - } - }, - Err(Err::Incomplete(_)) => { - return 0; - }, - Err(_) => { + } + Err(Err::Incomplete(_)) => match parse_rpc_packet_header(i) { + Ok((_, ref rpc_hdr)) => { + if rpc_hdr.frag_len >= 24 + && rpc_hdr.frag_len <= 35000 + && rpc_hdr.xid != 0 + && rpc_hdr.msgtype == 1 + { + SCLogDebug!( + "TC PROBE LEN {} XID {} TYPE {}", + rpc_hdr.frag_len, + rpc_hdr.xid, + rpc_hdr.msgtype + ); + return 1; + } else { return -1; - }, + } + } + Err(Err::Incomplete(_)) => { + return 0; + } + Err(_) => { + return -1; } }, Err(_) => { return -1; - }, + } } } else { match parse_rpc(i, false) { Ok((_, ref rpc)) => { - if rpc.hdr.frag_len >= 40 && rpc.hdr.msgtype == 0 && - rpc.rpcver == 2 && (rpc.progver == 3 || rpc.progver == 4) && - rpc.program == 100003 && - rpc.procedure <= NFSPROC3_COMMIT + if rpc.hdr.frag_len >= 40 + && rpc.hdr.msgtype == 0 + && rpc.rpcver == 2 + && (rpc.progver == 3 || rpc.progver == 4) + && rpc.program == 100003 + && rpc.procedure <= NFSPROC3_COMMIT { return rpc_auth_type_known(rpc.creds_flavor) as i32; } else { return -1; } - }, + } Err(Err::Incomplete(_)) => { return 0; - }, + } Err(_) => { return -1; - }, + } } } } @@ -1844,46 +2137,61 @@ pub fn nfs_probe_udp(i: &[u8], direction: Direction) -> i32 { if direction == Direction::ToClient { match parse_rpc_udp_reply(i) { Ok((_, ref rpc)) => { - if i.len() >= 32 && rpc.hdr.msgtype == 1 && rpc.reply_state == 0 && rpc.accept_state == 0 { - SCLogDebug!("TC PROBE LEN {} XID {} TYPE {}", rpc.hdr.frag_len, rpc.hdr.xid, rpc.hdr.msgtype); + if i.len() >= 32 + && rpc.hdr.msgtype == 1 + && rpc.reply_state == 0 + && rpc.accept_state == 0 + { + SCLogDebug!( + "TC PROBE LEN {} XID {} TYPE {}", + rpc.hdr.frag_len, + rpc.hdr.xid, + rpc.hdr.msgtype + ); return 1; } else { return -1; } - }, + } Err(_) => { return -1; - }, + } } } else { match parse_rpc_udp_request(i) { Ok((_, ref rpc)) => { - if i.len() >= 48 && rpc.hdr.msgtype == 0 && rpc.progver == 3 && rpc.program == 100003 { + if i.len() >= 48 + && rpc.hdr.msgtype == 0 + && rpc.progver == 3 + && rpc.program == 100003 + { return 1; - } else if i.len() >= 48 && rpc.hdr.msgtype == 0 && rpc.progver == 2 && rpc.program == 100003 { + } else if i.len() >= 48 + && rpc.hdr.msgtype == 0 + && rpc.progver == 2 + && rpc.program == 100003 + { SCLogDebug!("NFSv2!"); return 1; } else { return -1; } - }, + } Err(_) => { return -1; - }, + } } } } /// MIDSTREAM #[no_mangle] -pub unsafe extern "C" fn rs_nfs_probe_ms( - _flow: *const Flow, - direction: u8, input: *const u8, - len: u32, rdir: *mut u8) -> AppProto -{ +pub unsafe extern fn rs_nfs_probe_ms( + _flow: *const Flow, direction: u8, input: *const u8, len: u32, rdir: *mut u8, +) -> AppProto { let slice: &[u8] = build_slice!(input, len as usize); SCLogDebug!("rs_nfs_probe_ms: probing direction {:02x}", direction); - let mut adirection : u8 = 0; + let mut adirection: u8 = 0; match nfs_probe_dir(slice, &mut adirection) { 1 => { if adirection == Direction::ToServer.into() { @@ -1893,73 +2201,61 @@ pub unsafe extern "C" fn rs_nfs_probe_ms( } match nfs_probe(slice, adirection.into()) { 1 => { - SCLogDebug!("nfs_probe success: dir {:02x} adir {:02x}", direction, adirection); + SCLogDebug!( + "nfs_probe success: dir {:02x} adir {:02x}", + direction, + adirection + ); if (direction & DIR_BOTH) != adirection { *rdir = adirection; } ALPROTO_NFS - }, - 0 => { ALPROTO_UNKNOWN }, - _ => { ALPROTO_FAILED }, + } + 0 => ALPROTO_UNKNOWN, + _ => ALPROTO_FAILED, } - }, - 0 => { - ALPROTO_UNKNOWN - }, - _ => { - ALPROTO_FAILED } + 0 => ALPROTO_UNKNOWN, + _ => ALPROTO_FAILED, } } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_probe(_f: *const Flow, - direction: u8, - input: *const u8, - len: u32, - _rdir: *mut u8) - -> AppProto -{ +pub unsafe extern fn rs_nfs_probe( + _f: *const Flow, direction: u8, input: *const u8, len: u32, _rdir: *mut u8, +) -> AppProto { let slice: &[u8] = build_slice!(input, len as usize); SCLogDebug!("rs_nfs_probe: running probe"); match nfs_probe(slice, direction.into()) { - 1 => { ALPROTO_NFS }, - -1 => { ALPROTO_FAILED }, - _ => { ALPROTO_UNKNOWN }, + 1 => ALPROTO_NFS, + -1 => ALPROTO_FAILED, + _ => ALPROTO_UNKNOWN, } } /// TOSERVER probe function #[no_mangle] -pub unsafe extern "C" fn rs_nfs_probe_udp_ts(_f: *const Flow, - _direction: u8, - input: *const u8, - len: u32, - _rdir: *mut u8) - -> AppProto -{ +pub unsafe extern fn rs_nfs_probe_udp_ts( + _f: *const Flow, _direction: u8, input: *const u8, len: u32, _rdir: *mut u8, +) -> AppProto { let slice: &[u8] = build_slice!(input, len as usize); match nfs_probe_udp(slice, Direction::ToServer) { - 1 => { ALPROTO_NFS }, - -1 => { ALPROTO_FAILED }, - _ => { ALPROTO_UNKNOWN }, + 1 => ALPROTO_NFS, + -1 => ALPROTO_FAILED, + _ => ALPROTO_UNKNOWN, } } /// TOCLIENT probe function #[no_mangle] -pub unsafe extern "C" fn rs_nfs_probe_udp_tc(_f: *const Flow, - _direction: u8, - input: *const u8, - len: u32, - _rdir: *mut u8) - -> AppProto -{ +pub unsafe extern fn rs_nfs_probe_udp_tc( + _f: *const Flow, _direction: u8, input: *const u8, len: u32, _rdir: *mut u8, +) -> AppProto { let slice: &[u8] = build_slice!(input, len as usize); match nfs_probe_udp(slice, Direction::ToClient) { - 1 => { ALPROTO_NFS }, - -1 => { ALPROTO_FAILED }, - _ => { ALPROTO_UNKNOWN }, + 1 => ALPROTO_NFS, + -1 => ALPROTO_FAILED, + _ => ALPROTO_UNKNOWN, } } @@ -1967,7 +2263,7 @@ pub unsafe extern "C" fn rs_nfs_probe_udp_tc(_f: *const Flow, const PARSER_NAME: &[u8] = b"nfs\0"; #[no_mangle] -pub unsafe extern "C" fn rs_nfs_register_parser() { +pub unsafe extern fn rs_nfs_register_parser() { let default_port = CString::new("[2049]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, @@ -1988,7 +2284,7 @@ pub unsafe extern "C" fn rs_nfs_register_parser() { tx_comp_st_tc: 1, tx_get_progress: rs_nfs_tx_get_alstate_progress, get_eventinfo: Some(NFSEvent::get_event_info), - get_eventinfo_byid : Some(NFSEvent::get_event_info_by_id), + get_eventinfo_byid: Some(NFSEvent::get_event_info_by_id), localstorage_new: None, localstorage_free: None, get_tx_files: Some(rs_nfs_gettxfiles), @@ -2004,38 +2300,50 @@ pub unsafe extern "C" fn rs_nfs_register_parser() { let ip_proto_str = CString::new("tcp").unwrap(); - if AppLayerProtoDetectConfProtoDetectionEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_NFS = alproto; let midstream = conf_get_bool("stream.midstream"); if midstream { - if AppLayerProtoDetectPPParseConfPorts(ip_proto_str.as_ptr(), IPPROTO_TCP, - parser.name, ALPROTO_NFS, 0, NFS_MIN_FRAME_LEN, - rs_nfs_probe_ms, rs_nfs_probe_ms) == 0 { + if AppLayerProtoDetectPPParseConfPorts( + ip_proto_str.as_ptr(), + IPPROTO_TCP, + parser.name, + ALPROTO_NFS, + 0, + NFS_MIN_FRAME_LEN, + rs_nfs_probe_ms, + rs_nfs_probe_ms, + ) == 0 + { SCLogDebug!("No NFSTCP app-layer configuration, enabling NFSTCP detection TCP detection on port {:?}.", default_port); /* register 'midstream' probing parsers if midstream is enabled. */ - AppLayerProtoDetectPPRegister(IPPROTO_TCP, - default_port.as_ptr(), ALPROTO_NFS, 0, - NFS_MIN_FRAME_LEN, Direction::ToServer.into(), - rs_nfs_probe_ms, rs_nfs_probe_ms); + AppLayerProtoDetectPPRegister( + IPPROTO_TCP, + default_port.as_ptr(), + ALPROTO_NFS, + 0, + NFS_MIN_FRAME_LEN, + Direction::ToServer.into(), + rs_nfs_probe_ms, + rs_nfs_probe_ms, + ); } } else { - AppLayerProtoDetectPPRegister(IPPROTO_TCP, - default_port.as_ptr(), ALPROTO_NFS, 0, - NFS_MIN_FRAME_LEN, Direction::ToServer.into(), - rs_nfs_probe, rs_nfs_probe); - } - if AppLayerParserConfParserEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + AppLayerProtoDetectPPRegister( + IPPROTO_TCP, + default_port.as_ptr(), + ALPROTO_NFS, + 0, + NFS_MIN_FRAME_LEN, + Direction::ToServer.into(), + rs_nfs_probe, + rs_nfs_probe, + ); + } + if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust nfs parser registered."); @@ -2045,7 +2353,7 @@ pub unsafe extern "C" fn rs_nfs_register_parser() { } #[no_mangle] -pub unsafe extern "C" fn rs_nfs_udp_register_parser() { +pub unsafe extern fn rs_nfs_udp_register_parser() { let default_port = CString::new("[2049]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, @@ -2066,7 +2374,7 @@ pub unsafe extern "C" fn rs_nfs_udp_register_parser() { tx_comp_st_tc: 1, tx_get_progress: rs_nfs_tx_get_alstate_progress, get_eventinfo: Some(NFSEvent::get_event_info), - get_eventinfo_byid : Some(NFSEvent::get_event_info_by_id), + get_eventinfo_byid: Some(NFSEvent::get_event_info_by_id), localstorage_new: None, localstorage_free: None, get_tx_files: Some(rs_nfs_gettxfiles), @@ -2082,29 +2390,35 @@ pub unsafe extern "C" fn rs_nfs_udp_register_parser() { let ip_proto_str = CString::new("udp").unwrap(); - if AppLayerProtoDetectConfProtoDetectionEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_NFS = alproto; - if AppLayerProtoDetectPPParseConfPorts(ip_proto_str.as_ptr(), IPPROTO_UDP, - parser.name, ALPROTO_NFS, 0, NFS_MIN_FRAME_LEN, - rs_nfs_probe_udp_ts, rs_nfs_probe_udp_tc) == 0 { - SCLogDebug!("No NFSUDP app-layer configuration, enabling NFSUDP detection UDP detection on port {:?}.", - default_port); - AppLayerProtoDetectPPRegister(IPPROTO_UDP, - default_port.as_ptr(), ALPROTO_NFS, 0, - NFS_MIN_FRAME_LEN, Direction::ToServer.into(), - rs_nfs_probe_udp_ts, rs_nfs_probe_udp_tc); - } - if AppLayerParserConfParserEnabled( + if AppLayerProtoDetectPPParseConfPorts( ip_proto_str.as_ptr(), + IPPROTO_UDP, parser.name, - ) != 0 + ALPROTO_NFS, + 0, + NFS_MIN_FRAME_LEN, + rs_nfs_probe_udp_ts, + rs_nfs_probe_udp_tc, + ) == 0 { + SCLogDebug!("No NFSUDP app-layer configuration, enabling NFSUDP detection UDP detection on port {:?}.", + default_port); + AppLayerProtoDetectPPRegister( + IPPROTO_UDP, + default_port.as_ptr(), + ALPROTO_NFS, + 0, + NFS_MIN_FRAME_LEN, + Direction::ToServer.into(), + rs_nfs_probe_udp_ts, + rs_nfs_probe_udp_tc, + ); + } + if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } if let Some(val) = conf_get("app-layer.protocols.nfs.max-tx") { diff --git a/rust/src/nfs/nfs2.rs b/rust/src/nfs/nfs2.rs index f8000b4892a4..5229640c310e 100644 --- a/rust/src/nfs/nfs2.rs +++ b/rust/src/nfs/nfs2.rs @@ -18,18 +18,23 @@ // written by Victor Julien use crate::nfs::nfs::*; -use crate::nfs::types::*; -use crate::nfs::rpc_records::*; use crate::nfs::nfs2_records::*; +use crate::nfs::rpc_records::*; +use crate::nfs::types::*; -use nom7::IResult; use nom7::number::streaming::be_u32; +use nom7::IResult; impl NFSState { /// complete request record pub fn process_request_record_v2(&mut self, r: &RpcPacket) { - SCLogDebug!("NFSv2: REQUEST {} procedure {} ({}) blob size {}", - r.hdr.xid, r.procedure, self.requestmap.len(), r.prog_data.len()); + SCLogDebug!( + "NFSv2: REQUEST {} procedure {} ({}) blob size {}", + r.hdr.xid, + r.procedure, + self.requestmap.len(), + r.prog_data.len() + ); let mut xidmap = NFSRequestXidMap::new(r.progver, r.procedure, 0); let aux_file_name = Vec::new(); @@ -39,10 +44,10 @@ impl NFSState { Ok((_, ar)) => { xidmap.file_handle = ar.handle.value.to_vec(); self.xidmap_handle2name(&mut xidmap); - }, + } _ => { self.set_event(NFSEvent::MalformedData); - }, + } }; } else if r.procedure == NFSPROC3_READ { match parse_nfs2_request_read(r.prog_data) { @@ -50,16 +55,17 @@ impl NFSState { xidmap.chunk_offset = read_record.offset as u64; xidmap.file_handle = read_record.handle.value.to_vec(); self.xidmap_handle2name(&mut xidmap); - }, + } _ => { self.set_event(NFSEvent::MalformedData); - }, + } }; } if !(r.procedure == NFSPROC3_COMMIT || // commit handled separately r.procedure == NFSPROC3_WRITE || // write handled in file tx - r.procedure == NFSPROC3_READ) // read handled in file tx at reply + r.procedure == NFSPROC3_READ) + // read handled in file tx at reply { let mut tx = self.new_tx(); tx.xid = r.hdr.xid; @@ -80,11 +86,15 @@ impl NFSState { tx.request_machine_name = u.machine_name_buf.to_vec(); tx.request_uid = u.uid; tx.request_gid = u.gid; - }, - _ => { }, + } + _ => {} } - SCLogDebug!("NFSv2: TX created: ID {} XID {} PROCEDURE {}", - tx.id, tx.xid, tx.procedure); + SCLogDebug!( + "NFSv2: TX created: ID {} XID {} PROCEDURE {}", + tx.id, + tx.xid, + tx.procedure + ); self.transactions.push(tx); } @@ -102,20 +112,24 @@ impl NFSState { SCLogDebug!("NFSv2: READ reply record"); self.process_read_record(r, reply, Some(xidmap)); nfs_status = reply.status; - }, + } _ => { self.set_event(NFSEvent::MalformedData); - }, + } } } else { - let stat : u32 = match be_u32(r.prog_data) as IResult<&[u8],_> { + let stat: u32 = match be_u32(r.prog_data) as IResult<&[u8], _> { Ok((_, stat)) => stat, - _ => 0 + _ => 0, }; nfs_status = stat; } - SCLogDebug!("NFSv2: REPLY {} to procedure {} blob size {}", - r.hdr.xid, xidmap.procedure, r.prog_data.len()); + SCLogDebug!( + "NFSv2: REPLY {} to procedure {} blob size {}", + r.hdr.xid, + xidmap.procedure, + r.prog_data.len() + ); self.mark_response_tx_done(r.hdr.xid, r.reply_state, nfs_status, &resp_handle); } diff --git a/rust/src/nfs/nfs2_records.rs b/rust/src/nfs/nfs2_records.rs index d8fe84f49d8f..58c758a34d37 100644 --- a/rust/src/nfs/nfs2_records.rs +++ b/rust/src/nfs/nfs2_records.rs @@ -19,13 +19,13 @@ use crate::nfs::nfs_records::*; use nom7::bytes::streaming::take; -use nom7::combinator::{rest, cond}; +use nom7::combinator::{cond, rest}; use nom7::number::streaming::be_u32; use nom7::IResult; -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs2Handle<'a> { - pub value: &'a[u8], + pub value: &'a [u8], } pub fn parse_nfs2_handle(i: &[u8]) -> IResult<&[u8], Nfs2Handle> { @@ -33,7 +33,7 @@ pub fn parse_nfs2_handle(i: &[u8]) -> IResult<&[u8], Nfs2Handle> { Ok((i, Nfs2Handle { value })) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs2RequestLookup<'a> { pub handle: Nfs2Handle<'a>, pub name_vec: Vec, @@ -51,7 +51,7 @@ pub fn parse_nfs2_request_lookup(i: &[u8]) -> IResult<&[u8], Nfs2RequestLookup> Ok((i, req)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs2RequestRead<'a> { pub handle: Nfs2Handle<'a>, pub offset: u32, @@ -84,8 +84,8 @@ pub fn parse_nfs2_reply_read(i: &[u8]) -> IResult<&[u8], NfsReplyRead> { Ok((i, reply)) } -#[derive(Debug,PartialEq, Eq)] -pub struct Nfs2Attributes<> { +#[derive(Debug, PartialEq, Eq)] +pub struct Nfs2Attributes { pub atype: u32, pub asize: u32, } diff --git a/rust/src/nfs/nfs3.rs b/rust/src/nfs/nfs3.rs index 032751f536ca..2f5ef46e84c9 100644 --- a/rust/src/nfs/nfs3.rs +++ b/rust/src/nfs/nfs3.rs @@ -20,18 +20,23 @@ use crate::core::*; use crate::nfs::nfs::*; -use crate::nfs::types::*; -use crate::nfs::rpc_records::*; use crate::nfs::nfs3_records::*; +use crate::nfs::rpc_records::*; +use crate::nfs::types::*; -use nom7::IResult; use nom7::number::streaming::be_u32; +use nom7::IResult; impl NFSState { /// complete NFS3 request record pub fn process_request_record_v3(&mut self, r: &RpcPacket) { - SCLogDebug!("REQUEST {} procedure {} ({}) blob size {}", - r.hdr.xid, r.procedure, self.requestmap.len(), r.prog_data.len()); + SCLogDebug!( + "REQUEST {} procedure {} ({}) blob size {}", + r.hdr.xid, + r.procedure, + self.requestmap.len(), + r.prog_data.len() + ); let mut xidmap = NFSRequestXidMap::new(r.progver, r.procedure, 0); let mut aux_file_name = Vec::new(); @@ -42,7 +47,6 @@ impl NFSState { if r.procedure == NFSPROC3_LOOKUP { self.process_request_record_lookup(r, &mut xidmap); - } else if r.procedure == NFSPROC3_ACCESS { if let Ok((_, rd)) = parse_nfs3_request_access(r.prog_data) { xidmap.file_handle = rd.handle.value.to_vec(); @@ -136,7 +140,8 @@ impl NFSState { if !(r.procedure == NFSPROC3_COMMIT || // commit handled separately r.procedure == NFSPROC3_WRITE || // write handled in file tx - r.procedure == NFSPROC3_READ) // read handled in file tx at reply + r.procedure == NFSPROC3_READ) + // read handled in file tx at reply { let mut tx = self.new_tx(); tx.xid = r.hdr.xid; @@ -157,18 +162,23 @@ impl NFSState { tx.request_machine_name = u.machine_name_buf.to_vec(); tx.request_uid = u.uid; tx.request_gid = u.gid; - }, - _ => { }, + } + _ => {} } - SCLogDebug!("TX created: ID {} XID {} PROCEDURE {}", - tx.id, tx.xid, tx.procedure); + SCLogDebug!( + "TX created: ID {} XID {} PROCEDURE {}", + tx.id, + tx.xid, + tx.procedure + ); self.transactions.push(tx); - } else if r.procedure == NFSPROC3_READ { - - let found = self.get_file_tx_by_handle(&xidmap.file_handle, Direction::ToClient).is_some(); + let found = self + .get_file_tx_by_handle(&xidmap.file_handle, Direction::ToClient) + .is_some(); if !found { - let tx = self.new_file_tx(&xidmap.file_handle, &xidmap.file_name, Direction::ToClient); + let tx = + self.new_file_tx(&xidmap.file_handle, &xidmap.file_name, Direction::ToClient); tx.procedure = NFSPROC3_READ; tx.xid = r.hdr.xid; tx.is_first = true; @@ -198,7 +208,8 @@ impl NFSState { nfs_status = rd.status; SCLogDebug!("LOOKUP handle {:?}", rd.handle); - self.namemap.insert(rd.handle.value.to_vec(), xidmap.file_name.to_vec()); + self.namemap + .insert(rd.handle.value.to_vec(), xidmap.file_name.to_vec()); resp_handle = rd.handle.value.to_vec(); } else { self.set_event(NFSEvent::MalformedData); @@ -211,7 +222,8 @@ impl NFSState { if let Some(h) = rd.handle { SCLogDebug!("handle {:?}", h); - self.namemap.insert(h.value.to_vec(), xidmap.file_name.to_vec()); + self.namemap + .insert(h.value.to_vec(), xidmap.file_name.to_vec()); resp_handle = h.value.to_vec(); } } else { @@ -230,7 +242,7 @@ impl NFSState { // cut off final eof field let d = if rd.data.len() >= 4 { - &rd.data[..rd.data.len()-4_usize] + &rd.data[..rd.data.len() - 4_usize] } else { rd.data }; @@ -244,8 +256,7 @@ impl NFSState { SCLogDebug!("e {:?}", e); if let Some(ref h) = e.handle { SCLogDebug!("h {:?}", h); - self.namemap.insert(h.value.to_vec(), - e.name_vec.to_vec()); + self.namemap.insert(h.value.to_vec(), e.name_vec.to_vec()); } } } @@ -258,14 +269,18 @@ impl NFSState { } // for all other record types only parse the status else { - let stat : u32 = match be_u32(r.prog_data) as IResult<&[u8],_> { + let stat: u32 = match be_u32(r.prog_data) as IResult<&[u8], _> { Ok((_, stat)) => stat, - _ => 0 + _ => 0, }; nfs_status = stat; } - SCLogDebug!("REPLY {} to procedure {} blob size {}", - r.hdr.xid, xidmap.procedure, r.prog_data.len()); + SCLogDebug!( + "REPLY {} to procedure {} blob size {}", + r.hdr.xid, + xidmap.procedure, + r.prog_data.len() + ); if xidmap.procedure != NFSPROC3_READ { self.mark_response_tx_done(r.hdr.xid, r.reply_state, nfs_status, &resp_handle); diff --git a/rust/src/nfs/nfs3_records.rs b/rust/src/nfs/nfs3_records.rs index 952b367db827..300faf8937aa 100644 --- a/rust/src/nfs/nfs3_records.rs +++ b/rust/src/nfs/nfs3_records.rs @@ -17,13 +17,13 @@ //! Nom parsers for RPC & NFSv3 -use std::cmp; use crate::nfs::nfs_records::*; use nom7::bytes::streaming::take; use nom7::combinator::{complete, cond, rest, verify}; use nom7::multi::{length_data, many0}; use nom7::number::streaming::{be_u32, be_u64}; use nom7::IResult; +use std::cmp; #[derive(Debug, PartialEq, Eq)] pub struct Nfs3Handle<'a> { @@ -303,7 +303,6 @@ pub(crate) fn many0_nfs3_response_readdirplus_entries( many0(complete(parse_nfs3_response_readdirplus_entry_cond))(input) } - #[derive(Debug, PartialEq, Eq)] pub struct Nfs3RequestReaddirplus<'a> { pub handle: Nfs3Handle<'a>, @@ -364,7 +363,11 @@ pub fn parse_nfs3_request_write(i: &[u8], complete: bool) -> IResult<&[u8], Nfs3 let (i, count) = be_u32(i)?; let (i, stable) = verify(be_u32, |&v| v <= 2)(i)?; let (i, file_len) = verify(be_u32, |&v| v <= count)(i)?; - let fill_bytes = if file_len % 4 != 0 { 4 - file_len % 4 } else { 0 }; + let fill_bytes = if file_len % 4 != 0 { + 4 - file_len % 4 + } else { + 0 + }; // Handle the various file data parsing logics let (i, file_data) = if complete { parse_nfs3_data_complete(i, file_len as usize, fill_bytes as usize)? @@ -391,7 +394,11 @@ pub fn parse_nfs3_reply_read(i: &[u8], complete: bool) -> IResult<&[u8], NfsRepl let (i, count) = be_u32(i)?; let (i, eof) = verify(be_u32, |&v| v <= 1)(i)?; let (i, data_len) = verify(be_u32, |&v| v <= count)(i)?; - let fill_bytes = if data_len % 4 != 0 { 4 - data_len % 4 } else { 0 }; + let fill_bytes = if data_len % 4 != 0 { + 4 - data_len % 4 + } else { + 0 + }; // Handle the various file data parsing logics let (i, data) = if complete { parse_nfs3_data_complete(i, data_len as usize, fill_bytes as usize)? @@ -649,7 +656,6 @@ mod tests { #[test] fn test_nfs3_request_access() { - #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x20, /*handle_len: (32)*/ @@ -674,7 +680,6 @@ mod tests { #[test] fn test_nfs3_request_commit() { - // packet_bytes -- used [READ Call] message digest #[rustfmt::skip] let buf: &[u8] = &[ @@ -700,7 +705,6 @@ mod tests { #[test] fn test_nfs3_request_read() { - #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x20, /*handle_len: (32)*/ @@ -726,7 +730,6 @@ mod tests { #[test] fn test_nfs3_request_lookup() { - #[rustfmt::skip] let buf: &[u8] = &[ // [handle] @@ -755,7 +758,6 @@ mod tests { #[test] fn test_nfs3_response_readdirplus() { - #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x00, /*status*/ @@ -835,15 +837,24 @@ mod tests { match response { (r, entries) => { assert_eq!(r.len(), 4); - assert_eq!(entries[0], Nfs3ResponseReaddirplusEntry { entry: Some(entry0) }); - assert_eq!(entries[1], Nfs3ResponseReaddirplusEntry { entry: Some(entry1) }); + assert_eq!( + entries[0], + Nfs3ResponseReaddirplusEntry { + entry: Some(entry0) + } + ); + assert_eq!( + entries[1], + Nfs3ResponseReaddirplusEntry { + entry: Some(entry1) + } + ); } } } #[test] fn test_nfs3_response_readdirplus_entry() { - #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x01, /*value_follows*/ @@ -875,17 +886,20 @@ mod tests { let (_, response) = parse_nfs3_response_readdirplus_entry_cond(buf).unwrap(); match response { - Nfs3ResponseReaddirplusEntry { entry: Some(entry_c) } => { + Nfs3ResponseReaddirplusEntry { + entry: Some(entry_c), + } => { assert_eq!(entry_c.name_vec, ".".as_bytes()); assert_eq!(entry_c.handle, Some(entry_handle)); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } #[test] fn test_nfs3_request_readdirplus() { - #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x24, /*handle_len*/ @@ -920,7 +934,6 @@ mod tests { #[test] fn test_nfs3_request_write() { - #[rustfmt::skip] let buf: &[u8] = &[ // [handle] @@ -958,7 +971,6 @@ mod tests { #[test] fn test_nfs3_reply_read() { - #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x00, /*Status: NFS3_OK (0)*/ diff --git a/rust/src/nfs/nfs4.rs b/rust/src/nfs/nfs4.rs index 730e82ba1b60..c33a5a9c4e4c 100644 --- a/rust/src/nfs/nfs4.rs +++ b/rust/src/nfs/nfs4.rs @@ -68,9 +68,16 @@ impl NFSState { let found = match self.get_file_tx_by_handle(&file_handle, Direction::ToServer) { Some(tx) => { if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, w.data, w.offset, - w.write_len, fill_bytes as u8, is_last, &r.hdr.xid); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + w.data, + w.offset, + w.write_len, + fill_bytes as u8, + is_last, + &r.hdr.xid, + ); tdf.chunk_count += 1; if is_last { tdf.file_last_xid = r.hdr.xid; @@ -85,9 +92,16 @@ impl NFSState { if !found { let tx = self.new_file_tx(&file_handle, &file_name, Direction::ToServer); if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, w.data, w.offset, - w.write_len, fill_bytes as u8, is_last, &r.hdr.xid); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + w.data, + w.offset, + w.write_len, + fill_bytes as u8, + is_last, + &r.hdr.xid, + ); tx.procedure = NFSPROC4_WRITE; tx.xid = r.hdr.xid; tx.is_first = true; @@ -102,7 +116,7 @@ impl NFSState { } self.ts_chunk_xid = r.hdr.xid; debug_validate_bug_on!(w.data.len() as u32 > w.write_len); - self.ts_chunk_left = w.write_len - w.data.len() as u32; + self.ts_chunk_left = w.write_len - w.data.len() as u32; } fn close_v4<'b>(&mut self, r: &RpcPacket<'b>, fh: &'b [u8]) { @@ -125,8 +139,7 @@ impl NFSState { } fn new_tx_v4( - &mut self, r: &RpcPacket, xidmap: &NFSRequestXidMap, procedure: u32, - _aux_opcodes: &[u32], + &mut self, r: &RpcPacket, xidmap: &NFSRequestXidMap, procedure: u32, _aux_opcodes: &[u32], ) { let mut tx = self.new_tx(); tx.xid = r.hdr.xid; @@ -319,7 +332,7 @@ impl NFSState { match *c { Nfs4ResponseContent::ReadDir(_s, Some(ref rd)) => { SCLogDebug!("READDIRv4: status {} eof {}", _s, rd.eof); - + #[allow(clippy::manual_flatten)] for d in &rd.listing { if let Some(_d) = d { @@ -382,9 +395,7 @@ impl NFSState { } } - pub fn process_reply_record_v4( - &mut self, r: &RpcReplyPacket, xidmap: &mut NFSRequestXidMap, - ) { + pub fn process_reply_record_v4(&mut self, r: &RpcReplyPacket, xidmap: &mut NFSRequestXidMap) { if xidmap.procedure == NFSPROC4_COMPOUND { let mut data = r.prog_data; diff --git a/rust/src/nfs/nfs4_records.rs b/rust/src/nfs/nfs4_records.rs index 9d61da39d33e..c8f5aa94cc8b 100644 --- a/rust/src/nfs/nfs4_records.rs +++ b/rust/src/nfs/nfs4_records.rs @@ -17,7 +17,7 @@ //! Nom parsers for NFSv4 records use nom7::bytes::streaming::{tag, take}; -use nom7::combinator::{complete, cond, map, peek, verify, rest}; +use nom7::combinator::{complete, cond, map, peek, rest, verify}; use nom7::error::{make_error, ErrorKind}; use nom7::multi::{count, many_till}; use nom7::number::streaming::{be_u32, be_u64}; @@ -26,9 +26,9 @@ use nom7::{Err, IResult}; use crate::nfs::types::*; /*https://datatracker.ietf.org/doc/html/rfc7530 - section 16.16 File Delegation Types */ -const OPEN_DELEGATE_NONE: u32 = 0; -const OPEN_DELEGATE_READ: u32 = 1; -const OPEN_DELEGATE_WRITE: u32 = 2; +const OPEN_DELEGATE_NONE: u32 = 0; +const OPEN_DELEGATE_READ: u32 = 1; +const OPEN_DELEGATE_WRITE: u32 = 2; const RPCSEC_GSS: u32 = 6; @@ -36,7 +36,7 @@ const RPCSEC_GSS: u32 = 6; // Linux defines NFSD_MAX_OPS_PER_COMPOUND to 16 (tested in Linux 5.15.1). const NFSD_MAX_OPS_PER_COMPOUND: usize = 64; -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub enum Nfs4RequestContent<'a> { PutFH(Nfs4Handle<'a>), GetFH, @@ -56,7 +56,7 @@ pub enum Nfs4RequestContent<'a> { GetAttr(Nfs4Attr), SetAttr(Nfs4RequestSetAttr<'a>), Renew(u64), - Remove(&'a[u8]), + Remove(&'a [u8]), DelegReturn(Nfs4StateId<'a>), SetClientId(Nfs4RequestSetClientId<'a>), SetClientIdConfirm, @@ -68,11 +68,11 @@ pub enum Nfs4RequestContent<'a> { LayoutGet(Nfs4RequestLayoutGet<'a>), GetDevInfo(Nfs4RequestGetDevInfo<'a>), LayoutReturn(Nfs4RequestLayoutReturn<'a>), - DestroySession(&'a[u8]), - DestroyClientID(&'a[u8]), + DestroySession(&'a [u8]), + DestroyClientID(&'a [u8]), } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4Attr { attr_mask: u64, } @@ -106,10 +106,10 @@ fn nfs4_parse_attrbits(i: &[u8]) -> IResult<&[u8], Nfs4Attr> { Ok((i, attr)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4StateId<'a> { pub seqid: u32, - pub data: &'a[u8], + pub data: &'a [u8], } fn nfs4_parse_stateid(i: &[u8]) -> IResult<&[u8], Nfs4StateId> { @@ -119,10 +119,10 @@ fn nfs4_parse_stateid(i: &[u8]) -> IResult<&[u8], Nfs4StateId> { Ok((i, state)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4Handle<'a> { pub len: u32, - pub value: &'a[u8], + pub value: &'a [u8], } fn nfs4_parse_handle(i: &[u8]) -> IResult<&[u8], Nfs4Handle> { @@ -145,7 +145,7 @@ pub struct Nfs4RequestLayoutReturn<'a> { pub return_type: u32, pub length: u64, pub stateid: Nfs4StateId<'a>, - pub lrf_data: &'a[u8], + pub lrf_data: &'a [u8], } fn nfs4_req_layoutreturn(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -169,7 +169,7 @@ fn nfs4_req_layoutreturn(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { #[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestGetDevInfo<'a> { - pub device_id: &'a[u8], + pub device_id: &'a [u8], pub layout_type: u32, pub maxcount: u32, pub notify_mask: u32, @@ -192,9 +192,9 @@ fn nfs4_req_getdevinfo(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { #[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestCreateSession<'a> { - pub client_id: &'a[u8], + pub client_id: &'a [u8], pub seqid: u32, - pub machine_name: &'a[u8], + pub machine_name: &'a [u8], } fn nfs4_req_create_session(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -222,11 +222,11 @@ fn nfs4_req_putfh(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { map(nfs4_parse_handle, Nfs4RequestContent::PutFH)(i) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestSetClientId<'a> { - pub client_id: &'a[u8], - pub r_netid: &'a[u8], - pub r_addr: &'a[u8], + pub client_id: &'a [u8], + pub r_netid: &'a [u8], + pub r_addr: &'a [u8], } fn nfs4_req_setclientid(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -239,7 +239,7 @@ fn nfs4_req_setclientid(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { let req = Nfs4RequestContent::SetClientId(Nfs4RequestSetClientId { client_id, r_netid, - r_addr + r_addr, }); Ok((i, req)) } @@ -250,11 +250,11 @@ fn nfs4_req_setclientid_confirm(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> Ok((i, Nfs4RequestContent::SetClientIdConfirm)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestCreate<'a> { pub ftype4: u32, - pub filename: &'a[u8], - pub link_content: &'a[u8], + pub filename: &'a [u8], + pub link_content: &'a [u8], } fn nfs4_req_create(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -270,9 +270,9 @@ fn nfs4_req_create(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { Ok((i, req)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub enum Nfs4OpenRequestContent<'a> { - Exclusive4(&'a[u8]), + Exclusive4(&'a [u8]), Unchecked4(Nfs4Attr), Guarded4(Nfs4Attr), } @@ -295,15 +295,17 @@ fn nfs4_req_open_type(i: &[u8]) -> IResult<&[u8], Nfs4OpenRequestContent> { 0 => nfs4_req_open_unchecked4(i)?, 1 => nfs4_req_open_guarded4(i)?, 2 => nfs4_req_open_exclusive4(i)?, - _ => { return Err(Err::Error(make_error(i, ErrorKind::Switch))); } + _ => { + return Err(Err::Error(make_error(i, ErrorKind::Switch))); + } }; Ok((i, data)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestOpen<'a> { pub open_type: u32, - pub filename: &'a[u8], + pub filename: &'a [u8], pub open_data: Option>, } @@ -321,7 +323,7 @@ fn nfs4_req_open(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { let req = Nfs4RequestContent::Open(Nfs4RequestOpen { open_type, filename, - open_data + open_data, }); Ok((i, req)) } @@ -335,25 +337,22 @@ fn nfs4_req_readdir(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { Ok((i, Nfs4RequestContent::ReadDir)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestRename<'a> { - pub oldname: &'a[u8], - pub newname: &'a[u8], + pub oldname: &'a [u8], + pub newname: &'a [u8], } fn nfs4_req_rename(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { let (i, oldname) = nfs4_parse_nfsstring(i)?; let (i, newname) = nfs4_parse_nfsstring(i)?; - let req = Nfs4RequestContent::Rename(Nfs4RequestRename { - oldname, - newname - }); + let req = Nfs4RequestContent::Rename(Nfs4RequestRename { oldname, newname }); Ok((i, req)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestLookup<'a> { - pub filename: &'a[u8], + pub filename: &'a [u8], } fn nfs4_req_destroy_session(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -372,10 +371,10 @@ fn nfs4_req_remove(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { } fn nfs4_req_secinfo_no_name(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { - map(be_u32, Nfs4RequestContent::SecInfoNoName) (i) + map(be_u32, Nfs4RequestContent::SecInfoNoName)(i) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestSetAttr<'a> { pub stateid: Nfs4StateId<'a>, } @@ -391,13 +390,13 @@ fn nfs4_req_getattr(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { map(nfs4_parse_attrbits, Nfs4RequestContent::GetAttr)(i) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestWrite<'a> { pub stateid: Nfs4StateId<'a>, pub offset: u64, pub stable: u32, pub write_len: u32, - pub data: &'a[u8], + pub data: &'a [u8], } fn nfs4_req_write(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -417,7 +416,7 @@ fn nfs4_req_write(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { Ok((i, req)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestRead<'a> { pub stateid: Nfs4StateId<'a>, pub offset: u64, @@ -442,7 +441,7 @@ fn nfs4_req_close(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { Ok((i, Nfs4RequestContent::Close(stateid))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestOpenConfirm<'a> { pub stateid: Nfs4StateId<'a>, } @@ -450,9 +449,7 @@ pub struct Nfs4RequestOpenConfirm<'a> { fn nfs4_req_open_confirm(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { let (i, _seq_id) = be_u32(i)?; let (i, stateid) = nfs4_parse_stateid(i)?; - let req = Nfs4RequestContent::OpenConfirm(Nfs4RequestOpenConfirm { - stateid - }); + let req = Nfs4RequestContent::OpenConfirm(Nfs4RequestOpenConfirm { stateid }); Ok((i, req)) } @@ -487,7 +484,10 @@ fn nfs4_req_commit(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { } fn nfs4_req_reclaim_complete(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { - map(verify(be_u32, |&v| v <= 1), Nfs4RequestContent::ReclaimComplete) (i) + map( + verify(be_u32, |&v| v <= 1), + Nfs4RequestContent::ReclaimComplete, + )(i) } fn nfs4_req_destroy_clientid(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -521,11 +521,11 @@ fn nfs4_req_layoutget(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { Ok((i, req)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestExchangeId<'a> { - pub client_string: &'a[u8], - pub nii_domain: &'a[u8], - pub nii_name: &'a[u8], + pub client_string: &'a [u8], + pub nii_domain: &'a [u8], + pub nii_name: &'a [u8], } fn nfs4_req_exchangeid(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -541,14 +541,14 @@ fn nfs4_req_exchangeid(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { let req = Nfs4RequestContent::ExchangeId(Nfs4RequestExchangeId { client_string: eia_clientstring, nii_domain, - nii_name + nii_name, }); Ok((i, req)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestSequence<'a> { - pub ssn_id: &'a[u8], + pub ssn_id: &'a [u8], } fn nfs4_req_sequence(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { @@ -557,9 +557,7 @@ fn nfs4_req_sequence(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent> { let (i, _slot_id) = be_u32(i)?; let (i, _high_slot_id) = be_u32(i)?; let (i, _cache_this) = be_u32(i)?; - let req = Nfs4RequestContent::Sequence(Nfs4RequestSequence { - ssn_id - }); + let req = Nfs4RequestContent::Sequence(Nfs4RequestSequence { ssn_id }); Ok((i, req)) } @@ -598,12 +596,14 @@ fn parse_request_compound_command(i: &[u8]) -> IResult<&[u8], Nfs4RequestContent NFSPROC4_LAYOUTRETURN => nfs4_req_layoutreturn(i)?, NFSPROC4_DESTROY_SESSION => nfs4_req_destroy_session(i)?, NFSPROC4_DESTROY_CLIENTID => nfs4_req_destroy_clientid(i)?, - _ => { return Err(Err::Error(make_error(i, ErrorKind::Switch))); } + _ => { + return Err(Err::Error(make_error(i, ErrorKind::Switch))); + } }; Ok((i, cmd_data)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4RequestCompoundRecord<'a> { pub commands: Vec>, } @@ -620,7 +620,7 @@ pub fn parse_nfs4_request_compound(i: &[u8]) -> IResult<&[u8], Nfs4RequestCompou Ok((i, Nfs4RequestCompoundRecord { commands })) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub enum Nfs4ResponseContent<'a> { PutFH(u32), PutRootFH(u32), @@ -657,7 +657,7 @@ pub enum Nfs4ResponseContent<'a> { } // might need improvement with a stateid_present = yes case -fn nfs4_res_layoutreturn(i:&[u8]) -> IResult<&[u8], Nfs4ResponseContent> { +fn nfs4_res_layoutreturn(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { let (i, status) = be_u32(i)?; let (i, _stateid_present) = verify(be_u32, |&v| v <= 1)(i)?; Ok((i, Nfs4ResponseContent::LayoutReturn(status))) @@ -665,7 +665,7 @@ fn nfs4_res_layoutreturn(i:&[u8]) -> IResult<&[u8], Nfs4ResponseContent> { #[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseCreateSession<'a> { - pub ssn_id: &'a[u8], + pub ssn_id: &'a [u8], pub seq_id: u32, } @@ -675,25 +675,25 @@ fn nfs4_parse_res_create_session(i: &[u8]) -> IResult<&[u8], Nfs4ResponseCreateS let (i, _flags) = be_u32(i)?; let (i, _fore_chan_attrs) = take(28_usize)(i)?; let (i, _back_chan_attrs) = take(28_usize)(i)?; - Ok((i, Nfs4ResponseCreateSession { - ssn_id, - seq_id - })) + Ok((i, Nfs4ResponseCreateSession { ssn_id, seq_id })) } fn nfs4_res_create_session(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { let (i, status) = be_u32(i)?; let (i, create_ssn_data) = cond(status == 0, nfs4_parse_res_create_session)(i)?; - Ok((i, Nfs4ResponseContent::CreateSession( status, create_ssn_data ))) + Ok(( + i, + Nfs4ResponseContent::CreateSession(status, create_ssn_data), + )) } #[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseExchangeId<'a> { - pub client_id: &'a[u8], + pub client_id: &'a [u8], pub eir_minorid: u64, - pub eir_majorid: &'a[u8], - pub nii_domain: &'a[u8], - pub nii_name: &'a[u8], + pub eir_majorid: &'a [u8], + pub nii_domain: &'a [u8], + pub nii_name: &'a [u8], } fn nfs4_parse_res_exchangeid(i: &[u8]) -> IResult<&[u8], Nfs4ResponseExchangeId> { @@ -709,26 +709,29 @@ fn nfs4_parse_res_exchangeid(i: &[u8]) -> IResult<&[u8], Nfs4ResponseExchangeId> let (i, nii_name) = nfs4_parse_nfsstring(i)?; let (i, _nii_date_sec) = be_u64(i)?; let (i, _nii_date_nsec) = be_u32(i)?; - Ok((i, Nfs4ResponseExchangeId { - client_id, - eir_minorid, - eir_majorid, - nii_domain, - nii_name, - })) + Ok(( + i, + Nfs4ResponseExchangeId { + client_id, + eir_minorid, + eir_majorid, + nii_domain, + nii_name, + }, + )) } fn nfs4_res_reclaim_complete(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { - map(be_u32, Nfs4ResponseContent::ReclaimComplete) (i) + map(be_u32, Nfs4ResponseContent::ReclaimComplete)(i) } fn nfs4_res_exchangeid(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { let (i, status) = be_u32(i)?; let (i, xchngid_data) = cond(status == 0, nfs4_parse_res_exchangeid)(i)?; - Ok((i, Nfs4ResponseContent::ExchangeId( status, xchngid_data))) + Ok((i, Nfs4ResponseContent::ExchangeId(status, xchngid_data))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseWrite { pub count: u32, pub committed: u32, @@ -747,11 +750,11 @@ fn nfs4_res_write(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { Ok((i, Nfs4ResponseContent::Write(status, wd))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseRead<'a> { pub eof: bool, pub count: u32, - pub data: &'a[u8], + pub data: &'a [u8], } fn nfs4_res_read_ok(i: &[u8]) -> IResult<&[u8], Nfs4ResponseRead> { @@ -759,7 +762,7 @@ fn nfs4_res_read_ok(i: &[u8]) -> IResult<&[u8], Nfs4ResponseRead> { let (i, read_len) = be_u32(i)?; let (i, read_data) = take(read_len as usize)(i)?; let resp = Nfs4ResponseRead { - eof: eof==1, + eof: eof == 1, count: read_len, data: read_data, }; @@ -772,7 +775,7 @@ fn nfs4_res_read(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { Ok((i, Nfs4ResponseContent::Read(status, rd))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseOpen<'a> { pub stateid: Nfs4StateId<'a>, pub result_flags: u32, @@ -789,7 +792,7 @@ pub enum Nfs4ResponseFileDelegation<'a> { #[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseOpenDelegateWrite<'a> { pub stateid: Nfs4StateId<'a>, - pub who: &'a[u8], + pub who: &'a [u8], } fn nfs4_res_open_ok_delegate_write(i: &[u8]) -> IResult<&[u8], Nfs4ResponseFileDelegation> { @@ -801,13 +804,13 @@ fn nfs4_res_open_ok_delegate_write(i: &[u8]) -> IResult<&[u8], Nfs4ResponseFileD let (i, _ace_flags) = be_u32(i)?; let (i, _ace_mask) = be_u32(i)?; let (i, who) = nfs4_parse_nfsstring(i)?; - Ok((i, Nfs4ResponseFileDelegation::DelegateWrite(Nfs4ResponseOpenDelegateWrite { - stateid, - who, - }))) + Ok(( + i, + Nfs4ResponseFileDelegation::DelegateWrite(Nfs4ResponseOpenDelegateWrite { stateid, who }), + )) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseOpenDelegateRead<'a> { pub stateid: Nfs4StateId<'a>, } @@ -820,9 +823,10 @@ fn nfs4_res_open_ok_delegate_read(i: &[u8]) -> IResult<&[u8], Nfs4ResponseFileDe let (i, _ace_mask) = be_u32(i)?; let (i, who_len) = be_u32(i)?; let (i, _who) = take(who_len as usize)(i)?; - Ok((i, Nfs4ResponseFileDelegation::DelegateRead(Nfs4ResponseOpenDelegateRead { - stateid, - }))) + Ok(( + i, + Nfs4ResponseFileDelegation::DelegateRead(Nfs4ResponseOpenDelegateRead { stateid }), + )) } fn nfs4_parse_file_delegation(i: &[u8]) -> IResult<&[u8], Nfs4ResponseFileDelegation> { @@ -830,8 +834,13 @@ fn nfs4_parse_file_delegation(i: &[u8]) -> IResult<&[u8], Nfs4ResponseFileDelega let (i, file_delegation) = match delegation_type { OPEN_DELEGATE_READ => nfs4_res_open_ok_delegate_read(i)?, OPEN_DELEGATE_WRITE => nfs4_res_open_ok_delegate_write(i)?, - OPEN_DELEGATE_NONE => (i, Nfs4ResponseFileDelegation::DelegateNone(OPEN_DELEGATE_NONE)), - _ => { return Err(Err::Error(make_error(i, ErrorKind::Switch))); } + OPEN_DELEGATE_NONE => ( + i, + Nfs4ResponseFileDelegation::DelegateNone(OPEN_DELEGATE_NONE), + ), + _ => { + return Err(Err::Error(make_error(i, ErrorKind::Switch))); + } }; Ok((i, file_delegation)) } @@ -859,8 +868,8 @@ fn nfs4_res_open(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { #[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseGetDevInfo<'a> { pub layout_type: u32, - pub r_netid: &'a[u8], - pub r_addr: &'a[u8], + pub r_netid: &'a [u8], + pub r_addr: &'a [u8], pub notify_mask: u32, } @@ -872,18 +881,21 @@ fn nfs4_parse_res_getdevinfo(i: &[u8]) -> IResult<&[u8], Nfs4ResponseGetDevInfo> let (i, r_netid) = nfs4_parse_nfsstring(i)?; let (i, r_addr) = nfs4_parse_nfsstring(i)?; let (i, notify_mask) = be_u32(i)?; - Ok((i, Nfs4ResponseGetDevInfo { - layout_type, - r_netid, - r_addr, - notify_mask, - })) + Ok(( + i, + Nfs4ResponseGetDevInfo { + layout_type, + r_netid, + r_addr, + notify_mask, + }, + )) } fn nfs4_res_getdevinfo(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { let (i, status) = be_u32(i)?; let (i, getdevinfo) = cond(status == 0, nfs4_parse_res_getdevinfo)(i)?; - Ok((i, Nfs4ResponseContent::GetDevInfo( status, getdevinfo ))) + Ok((i, Nfs4ResponseContent::GetDevInfo(status, getdevinfo))) } /*https://datatracker.ietf.org/doc/html/rfc5661#section-13.1*/ @@ -893,12 +905,12 @@ pub struct Nfs4ResponseLayoutGet<'a> { pub stateid: Nfs4StateId<'a>, pub length: u64, pub layout_type: u32, - pub device_id: &'a[u8], + pub device_id: &'a [u8], pub file_handles: Vec>, } fn nfs4_parse_res_layoutget(i: &[u8]) -> IResult<&[u8], Nfs4ResponseLayoutGet> { - let (i, _return_on_close) = verify(be_u32, |&v| v <= 1)(i)?; + let (i, _return_on_close) = verify(be_u32, |&v| v <= 1)(i)?; let (i, stateid) = nfs4_parse_stateid(i)?; let (i, _layout_seg) = be_u32(i)?; let (i, _offset) = be_u64(i)?; @@ -917,19 +929,22 @@ fn nfs4_parse_res_layoutget(i: &[u8]) -> IResult<&[u8], Nfs4ResponseLayoutGet> { return Err(Err::Error(make_error(i, ErrorKind::Count))); } let (i, file_handles) = count(nfs4_parse_handle, fh_handles as usize)(i)?; - Ok((i, Nfs4ResponseLayoutGet { - stateid, - length, - layout_type, - device_id, - file_handles, - })) + Ok(( + i, + Nfs4ResponseLayoutGet { + stateid, + length, + layout_type, + device_id, + file_handles, + }, + )) } fn nfs4_res_layoutget(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { let (i, status) = be_u32(i)?; let (i, lyg_data) = cond(status == 0, nfs4_parse_res_layoutget)(i)?; - Ok((i, Nfs4ResponseContent::LayoutGet( status, lyg_data ))) + Ok((i, Nfs4ResponseContent::LayoutGet(status, lyg_data))) } // #[derive(Debug, PartialEq)] @@ -965,12 +980,12 @@ fn nfs4_res_secinfo_no_name(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { Ok((i, Nfs4ResponseContent::SecInfoNoName(status))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseReaddirEntry<'a> { - pub name: &'a[u8], + pub name: &'a [u8], } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseReaddir<'a> { pub eof: bool, pub listing: Vec>>, @@ -1114,7 +1129,7 @@ fn nfs4_res_commit(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { Ok((i, Nfs4ResponseContent::Commit(status))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseAccess { pub supported_types: u32, pub access_rights: u32, @@ -1125,7 +1140,7 @@ fn nfs4_res_access_ok(i: &[u8]) -> IResult<&[u8], Nfs4ResponseAccess> { let (i, access_rights) = be_u32(i)?; let resp = Nfs4ResponseAccess { supported_types, - access_rights + access_rights, }; Ok((i, resp)) } @@ -1136,9 +1151,9 @@ fn nfs4_res_access(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { Ok((i, Nfs4ResponseContent::Access(status, ad))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseSequence<'a> { - pub ssn_id: &'a[u8], + pub ssn_id: &'a [u8], } fn nfs4_res_sequence_ok(i: &[u8]) -> IResult<&[u8], Nfs4ResponseSequence> { @@ -1156,11 +1171,11 @@ fn nfs4_res_sequence(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { } fn nfs4_res_destroy_session(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { - map(be_u32, Nfs4ResponseContent::DestroySession) (i) + map(be_u32, Nfs4ResponseContent::DestroySession)(i) } fn nfs4_res_destroy_clientid(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { - map(be_u32, Nfs4ResponseContent::DestroyClientID) (i) + map(be_u32, Nfs4ResponseContent::DestroyClientID)(i) } fn nfs4_res_compound_command(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { @@ -1198,12 +1213,14 @@ fn nfs4_res_compound_command(i: &[u8]) -> IResult<&[u8], Nfs4ResponseContent> { NFSPROC4_LAYOUTRETURN => nfs4_res_layoutreturn(i)?, NFSPROC4_DESTROY_SESSION => nfs4_res_destroy_session(i)?, NFSPROC4_DESTROY_CLIENTID => nfs4_res_destroy_clientid(i)?, - _ => { return Err(Err::Error(make_error(i, ErrorKind::Switch))); } + _ => { + return Err(Err::Error(make_error(i, ErrorKind::Switch))); + } }; Ok((i, cmd_data)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Nfs4ResponseCompoundRecord<'a> { pub status: u32, pub commands: Vec>, @@ -1227,7 +1244,7 @@ mod tests { #[test] fn test_nfs4_request_compound() { - // Operations: SEQUENCE, PUTFH, CLOSE + // Operations: SEQUENCE, PUTFH, CLOSE #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x00, /*Tag*/ @@ -1289,17 +1306,19 @@ mod tests { ]; let (_, req_client_id) = nfs4_parse_nfsstring(&buf[12..64]).unwrap(); - let (_, req_r_netid) = nfs4_parse_nfsstring(&buf[68 ..76]).unwrap(); + let (_, req_r_netid) = nfs4_parse_nfsstring(&buf[68..76]).unwrap(); let (_, req_r_adrr) = nfs4_parse_nfsstring(&buf[76..100]).unwrap(); let (_, resquest) = nfs4_req_setclientid(&buf[4..]).unwrap(); match resquest { - Nfs4RequestContent::SetClientId( req_setclientid ) => { + Nfs4RequestContent::SetClientId(req_setclientid) => { assert_eq!(req_setclientid.client_id, req_client_id); assert_eq!(req_setclientid.r_netid, req_r_netid); assert_eq!(req_setclientid.r_addr, req_r_adrr); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1336,10 +1355,15 @@ mod tests { match request { Nfs4RequestContent::Open(req_open) => { assert_eq!(req_open.open_type, 1); - assert_eq!(req_open.open_data, Some(Nfs4OpenRequestContent::Unchecked4(attr_buf))); + assert_eq!( + req_open.open_data, + Some(Nfs4OpenRequestContent::Unchecked4(attr_buf)) + ); assert_eq!(req_open.filename, filename_buf); } - _ => { panic!("Failure, {:?}", request); } + _ => { + panic!("Failure, {:?}", request); + } } } @@ -1368,7 +1392,9 @@ mod tests { assert_eq!(req_write.write_len, 5); assert_eq!(req_write.data, "test\n".as_bytes()); } - _ => { panic!("Failure, {:?}", request); } + _ => { + panic!("Failure, {:?}", request); + } } } @@ -1417,7 +1443,9 @@ mod tests { assert_eq!(req_exchangeid.nii_domain, nii_domain_buf); assert_eq!(req_exchangeid.nii_name, nii_name_buf); } - _ => { panic!("Failure, {:?}", request); } + _ => { + panic!("Failure, {:?}", request); + } } } @@ -1438,7 +1466,9 @@ mod tests { Nfs4RequestContent::Close(req_stateid) => { assert_eq!(req_stateid, stateid_buf); } - _ => { panic!("Failure, {:?}", request); } + _ => { + panic!("Failure, {:?}", request); + } } } @@ -1460,7 +1490,9 @@ mod tests { Nfs4RequestContent::Sequence(seq_buf) => { assert_eq!(seq_buf.ssn_id, &buf[4..20]); } - _ => { panic!("Failure, {:?}", req_sequence); } + _ => { + panic!("Failure, {:?}", req_sequence); + } } } @@ -1479,7 +1511,9 @@ mod tests { Nfs4RequestContent::Lookup(req_lookup) => { assert_eq!(req_lookup.filename, filename_buf); } - _ => { panic!("Failure, {:?}", request); } + _ => { + panic!("Failure, {:?}", request); + } } } @@ -1503,7 +1537,9 @@ mod tests { assert_eq!(putfh_handle.value, handle_buf.value); assert_eq!(putfh_handle.len, handle_buf.len); } - _ => { panic!("Failure, {:?}", result); } + _ => { + panic!("Failure, {:?}", result); + } } } @@ -1512,30 +1548,26 @@ mod tests { let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x2b, /*opcode*/ 0xe0, 0x14, 0x82, 0x00, 0x00, 0x00, 0x02, 0xd2, // create_session - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x04, 0x14, - 0x00, 0x10, 0x03, 0x88, 0x00, 0x00, 0x0d, 0x64, - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x01, 0x0c, 0x09, 0x5e, 0x92, - 0x00, 0x00, 0x00, 0x09, 0x6e, 0x65, 0x74, 0x61, - 0x70, 0x70, 0x2d, 0x32, 0x36, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x04, 0x14, 0x00, 0x10, 0x03, 0x88, 0x00, 0x00, 0x0d, 0x64, 0x00, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x09, 0x5e, 0x92, 0x00, 0x00, 0x00, 0x09, + 0x6e, 0x65, 0x74, 0x61, 0x70, 0x70, 0x2d, 0x32, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; let (_, request) = nfs4_req_create_session(&buf[4..]).unwrap(); match request { - Nfs4RequestContent::CreateSession( create_ssn ) => { + Nfs4RequestContent::CreateSession(create_ssn) => { assert_eq!(create_ssn.client_id, &buf[4..12]); assert_eq!(create_ssn.seqid, 1); assert_eq!(create_ssn.machine_name, b"netapp-26"); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1544,12 +1576,10 @@ mod tests { let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x32, /*opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // layoutget - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x82, 0x14, 0xe0, 0x5b, 0x00, 0x89, 0xd9, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x82, 0x14, 0xe0, 0x5b, 0x00, 0x89, 0xd9, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, ]; let (_, stateid_buf) = nfs4_parse_stateid(&buf[40..56]).unwrap(); @@ -1557,12 +1587,14 @@ mod tests { let (_, request) = nfs4_req_layoutget(&buf[4..]).unwrap(); match request { - Nfs4RequestContent::LayoutGet( lyg_data ) => { + Nfs4RequestContent::LayoutGet(lyg_data) => { assert_eq!(lyg_data.layout_type, 1); assert_eq!(lyg_data.min_length, 4096); assert_eq!(lyg_data.stateid, stateid_buf); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1571,20 +1603,21 @@ mod tests { let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x2f, /*opcode*/ 0x01, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xfa, 0x80, // getdevinfo - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x3e, 0x20, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, + 0x3e, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, ]; let (_, request) = nfs4_req_getdevinfo(&buf[4..]).unwrap(); match request { - Nfs4RequestContent::GetDevInfo( getdevifo ) => { + Nfs4RequestContent::GetDevInfo(getdevifo) => { assert_eq!(getdevifo.device_id, &buf[4..20]); assert_eq!(getdevifo.layout_type, 1); assert_eq!(getdevifo.maxcount, 81440); assert_eq!(getdevifo.notify_mask, 6); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1593,12 +1626,10 @@ mod tests { let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x33, /*opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // layoutreturn - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x01, 0x03, 0x82, 0x14, 0xe0, - 0x5b, 0x00, 0x89, 0xd9, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, + 0x03, 0x82, 0x14, 0xe0, 0x5b, 0x00, 0x89, 0xd9, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, ]; let (_, stateid_buf) = nfs4_parse_stateid(&buf[36..52]).unwrap(); @@ -1606,12 +1637,14 @@ mod tests { let (_, request) = nfs4_req_layoutreturn(&buf[4..]).unwrap(); match request { - Nfs4RequestContent::LayoutReturn( layoutreturn ) => { + Nfs4RequestContent::LayoutReturn(layoutreturn) => { assert_eq!(layoutreturn.layout_type, 1); assert_eq!(layoutreturn.return_type, 1); assert_eq!(layoutreturn.stateid, stateid_buf); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1625,10 +1658,12 @@ mod tests { let (_, request) = nfs4_req_destroy_session(&buf[4..]).unwrap(); match request { - Nfs4RequestContent::DestroySession( ssn_id ) => { + Nfs4RequestContent::DestroySession(ssn_id) => { assert_eq!(ssn_id, &buf[4..]); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1650,7 +1685,7 @@ mod tests { } #[test] fn test_nfs4_response_compound() { - // Operations: SEQUENCE, PUTFH, CLOSE + // Operations: SEQUENCE, PUTFH, CLOSE #[rustfmt::skip] let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x00, /*status*/ @@ -1732,7 +1767,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(open_data, Some(res_open_data)); } - _ => { panic!("Failure, {:?}", response); } + _ => { + panic!("Failure, {:?}", response); + } } } @@ -1756,7 +1793,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(wd, Some(wd_buf)); } - _ => { panic!("Failure, {:?}", result); } + _ => { + panic!("Failure, {:?}", result); + } } } @@ -1779,7 +1818,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(ad, Some(ad_buf)); } - _ => { panic!("Failure, {:?}", result); } + _ => { + panic!("Failure, {:?}", result); + } } } @@ -1804,7 +1845,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(fh, Some(fh_buf)); } - _ => { panic!("Failure, {:?}", result); } + _ => { + panic!("Failure, {:?}", result); + } } } @@ -1837,7 +1880,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(attrs, Some(attrs_buf)); } - _ => { panic!("Failure, {:?}", result); } + _ => { + panic!("Failure, {:?}", result); + } } } @@ -1909,7 +1954,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(rd, Some(res_rd)); } - _ => { panic!("Failure!"); } + _ => { + panic!("Failure!"); + } } } @@ -1928,7 +1975,9 @@ mod tests { Nfs4ResponseContent::SetClientId(status) => { assert_eq!(status, 0); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1937,25 +1986,17 @@ mod tests { let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x2a, /*opcode*/ 0x00, 0x00, 0x00, 0x00, /*status*/ - // exchange_id - 0xe0, 0x14, 0x82, 0x00, 0x00, 0x00, 0x02, 0xd2, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x98, 0x3b, 0xa3, 0x1e, - 0xd7, 0xa9, 0x11, 0xe8, 0x00, 0x00, 0x00, 0x10, - 0x98, 0x3b, 0xa3, 0x1e, 0xd7, 0xa9, 0x11, 0xe8, - 0xbc, 0x0c, 0x00, 0x0c, 0x29, 0xe9, 0x13, 0x93, - 0x00, 0x00, 0x00, 0x10, 0x84, 0x8b, 0x93, 0x12, - 0xd7, 0xa9, 0x11, 0xe8, 0xbc, 0x0c, 0x00, 0x0c, - 0x29, 0xe9, 0x13, 0x93, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x0c, 0x6e, 0x65, 0x74, 0x61, - 0x70, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x24, 0x4e, 0x65, 0x74, 0x41, - 0x70, 0x70, 0x20, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x20, 0x56, 0x6f, 0x6f, 0x64, 0x6f, - 0x6f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x5f, - 0x5f, 0x39, 0x2e, 0x36, 0x2e, 0x30, 0x00, 0x00, - 0x26, 0x0d, 0xcf, 0x5b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + // exchange_id + 0xe0, 0x14, 0x82, 0x00, 0x00, 0x00, 0x02, 0xd2, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x3b, 0xa3, 0x1e, 0xd7, 0xa9, 0x11, 0xe8, + 0x00, 0x00, 0x00, 0x10, 0x98, 0x3b, 0xa3, 0x1e, 0xd7, 0xa9, 0x11, 0xe8, 0xbc, 0x0c, + 0x00, 0x0c, 0x29, 0xe9, 0x13, 0x93, 0x00, 0x00, 0x00, 0x10, 0x84, 0x8b, 0x93, 0x12, + 0xd7, 0xa9, 0x11, 0xe8, 0xbc, 0x0c, 0x00, 0x0c, 0x29, 0xe9, 0x13, 0x93, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x6e, 0x65, 0x74, 0x61, 0x70, 0x70, 0x2e, 0x63, + 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x4e, 0x65, 0x74, 0x41, 0x70, 0x70, + 0x20, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x56, 0x6f, 0x6f, 0x64, 0x6f, + 0x6f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x5f, 0x39, 0x2e, 0x36, 0x2e, 0x30, + 0x00, 0x00, 0x26, 0x0d, 0xcf, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; let (_, xchangeid) = nfs4_parse_res_exchangeid(&buf[8..]).unwrap(); @@ -1966,7 +2007,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(xchngid_data, Some(xchangeid)); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -1975,28 +2018,26 @@ mod tests { let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x2b, /*opcode*/ 0x00, 0x00, 0x00, 0x00, /*status*/ - // create_session - 0x00, 0x00, 0x02, 0xd2, 0xe0, 0x14, 0x82, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x18, 0x00, - 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x02, 0x80, - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + // create_session + 0x00, 0x00, 0x02, 0xd2, 0xe0, 0x14, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, ]; let (_, create_ssn) = nfs4_parse_res_create_session(&buf[8..]).unwrap(); let (_, response) = nfs4_res_create_session(&buf[4..]).unwrap(); match response { - Nfs4ResponseContent::CreateSession( status, create_ssn_data) => { + Nfs4ResponseContent::CreateSession(status, create_ssn_data) => { assert_eq!(status, 0); assert_eq!(create_ssn_data, Some(create_ssn)); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -2005,25 +2046,17 @@ mod tests { let buf: &[u8] = &[ 0x00, 0x00, 0x00, 0x32, /*opcode*/ 0x00, 0x00, 0x00, 0x00, /*status*/ - // layoutget - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x03, 0x82, 0x14, 0xe0, 0x5b, 0x00, 0x89, 0xd9, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x58, 0x01, 0x01, 0x00, 0x00, - 0x00, 0xf2, 0xfa, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x30, 0x01, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x84, 0x72, 0x00, 0x00, 0x23, 0xa6, 0xc0, 0x12, - 0x00, 0xf2, 0xfa, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, - 0x00, 0xf2, 0xfa, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, + // layoutget + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x82, 0x14, 0xe0, 0x5b, 0x00, + 0x89, 0xd9, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x01, 0x01, 0x00, 0x00, + 0x00, 0xf2, 0xfa, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x72, 0x00, 0x00, 0x23, 0xa6, 0xc0, 0x12, + 0x00, 0xf2, 0xfa, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, + 0x00, 0x00, 0x00, 0xf2, 0xfa, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, ]; let (_, stateid) = nfs4_parse_stateid(&buf[12..28]).unwrap(); @@ -2035,11 +2068,13 @@ mod tests { let (_, response) = nfs4_res_layoutget(&buf[4..]).unwrap(); match response { - Nfs4ResponseContent::LayoutGet( status, lyg ) => { + Nfs4ResponseContent::LayoutGet(status, lyg) => { assert_eq!(status, 0); assert_eq!(lyg, Some(lyg_data)); } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } @@ -2049,12 +2084,10 @@ mod tests { 0x00, 0x00, 0x00, 0x2f, /*opcode*/ 0x00, 0x00, 0x00, 0x00, /*status*/ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2c, // getdevinfo - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x03, 0x74, 0x63, 0x70, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x31, 0x39, 0x32, 0x2e, - 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x36, 0x31, - 0x2e, 0x38, 0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x74, 0x63, 0x70, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x31, 0x39, 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x36, 0x31, 0x2e, 0x38, + 0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, ]; let (_, getdevinfo) = nfs4_parse_res_getdevinfo(&buf[8..]).unwrap(); @@ -2068,7 +2101,9 @@ mod tests { assert_eq!(status, 0); assert_eq!(getdevinfo_data, Some(getdevinfo)) } - _ => { panic!("Failure"); } + _ => { + panic!("Failure"); + } } } } diff --git a/rust/src/nfs/nfs_records.rs b/rust/src/nfs/nfs_records.rs index 3b0804bfc0f0..183431ef4567 100644 --- a/rust/src/nfs/nfs_records.rs +++ b/rust/src/nfs/nfs_records.rs @@ -17,13 +17,13 @@ //! Nom parsers for NFS -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct NfsReplyRead<'a> { pub status: u32, pub attr_follows: u32, - pub attr_blob: &'a[u8], + pub attr_blob: &'a [u8], pub count: u32, pub eof: bool, pub data_len: u32, - pub data: &'a[u8], // likely partial + pub data: &'a [u8], // likely partial } diff --git a/rust/src/nfs/rpc_records.rs b/rust/src/nfs/rpc_records.rs index d373ae936ed6..43f35c707771 100644 --- a/rust/src/nfs/rpc_records.rs +++ b/rust/src/nfs/rpc_records.rs @@ -20,12 +20,12 @@ use crate::common::nom7::bits; use nom7::bits::streaming::take as take_bits; use nom7::bytes::streaming::take; -use nom7::combinator::{cond, verify, rest}; +use nom7::combinator::{cond, rest, verify}; +use nom7::error::{make_error, ErrorKind}; use nom7::multi::length_data; -use nom7::number::streaming::{be_u32}; +use nom7::number::streaming::be_u32; use nom7::sequence::tuple; -use nom7::error::{make_error, ErrorKind}; -use nom7::{IResult, Err}; +use nom7::{Err, IResult}; pub const RPC_MAX_MACHINE_SIZE: u32 = 256; // Linux kernel defines 64. pub const RPC_MAX_CREDS_SIZE: u32 = 4096; // Linux kernel defines 400. @@ -133,7 +133,7 @@ fn parse_bits(i: &[u8]) -> IResult<&[u8], (u8, u32)> { } pub fn parse_rpc_packet_header(i: &[u8]) -> IResult<&[u8], RpcPacketHeader> { - let (i, fraghdr) = verify(parse_bits, |v: &(u8,u32)| v.1 >= 24)(i)?; + let (i, fraghdr) = verify(parse_bits, |v: &(u8, u32)| v.1 >= 24)(i)?; let (i, xid) = be_u32(i)?; let (i, msgtype) = verify(be_u32, |&v| v <= 1)(i)?; let hdr = RpcPacketHeader { @@ -246,7 +246,7 @@ pub fn parse_rpc(start_i: &[u8], complete: bool) -> IResult<&[u8], RpcPacket> { return Err(Err::Error(make_error(i, ErrorKind::LengthValue))); } - let data_size : u32 = (rec_size - consumed) as u32; + let data_size: u32 = (rec_size - consumed) as u32; let (i, prog_data) = if !complete { rest(i)? } else { @@ -303,7 +303,7 @@ pub fn parse_rpc_reply(start_i: &[u8], complete: bool) -> IResult<&[u8], RpcRepl return Err(Err::Error(make_error(i, ErrorKind::LengthValue))); } - let data_size : u32 = (rec_size as usize - consumed) as u32; + let data_size: u32 = (rec_size as usize - consumed) as u32; let (i, prog_data) = if !complete { rest(i)? } else { @@ -359,7 +359,7 @@ pub fn parse_rpc_udp_request(i: &[u8]) -> IResult<&[u8], RpcPacket> { let (i, verifier_len) = verify(be_u32, |&size| size < RPC_MAX_VERIFIER_SIZE)(i)?; let (i, verifier) = take(verifier_len as usize)(i)?; - let data_size : u32 = i.len() as u32; + let data_size: u32 = i.len() as u32; let (i, prog_data) = rest(i)?; let packet = RpcPacket { hdr, @@ -393,7 +393,7 @@ pub fn parse_rpc_udp_reply(i: &[u8]) -> IResult<&[u8], RpcReplyPacket> { let (i, reply_state) = verify(be_u32, |&v| v <= 1)(i)?; let (i, accept_state) = be_u32(i)?; - let data_size : u32 = i.len() as u32; + let data_size: u32 = i.len() as u32; let (i, prog_data) = rest(i)?; let packet = RpcReplyPacket { hdr, @@ -421,13 +421,17 @@ mod tests { fn test_partial_input_too_short() { let buf: &[u8] = &[ 0x80, 0x00, 0x00, 0x9c, // flags - 0x8e, 0x28, 0x02, 0x7e // xid + 0x8e, 0x28, 0x02, 0x7e, // xid ]; let r = parse_rpc_request_partial(buf); match r { - Err(Incomplete(s)) => { assert_eq!(s, Needed::new(4)); }, - _ => { panic!("failed {:?}",r); } + Err(Incomplete(s)) => { + assert_eq!(s, Needed::new(4)); + } + _ => { + panic!("failed {:?}", r); + } } } #[test] @@ -443,23 +447,25 @@ mod tests { ]; let expected = RpcRequestPacketPartial { hdr: RpcPacketHeader { - frag_is_last: true, - frag_len: 156, - xid: 2384986750, - msgtype: 1 - }, + frag_is_last: true, + frag_len: 156, + xid: 2384986750, + msgtype: 1, + }, rpcver: 2, program: 3, progver: 4, - procedure: 5 + procedure: 5, }; let r = parse_rpc_request_partial(buf); match r { Ok((rem, hdr)) => { assert_eq!(rem.len(), 0); assert_eq!(hdr, expected); - }, - _ => { panic!("failed {:?}",r); } + } + _ => { + panic!("failed {:?}", r); + } } } } diff --git a/rust/src/nfs/types.rs b/rust/src/nfs/types.rs index 96195b9940ce..609d02be432d 100644 --- a/rust/src/nfs/types.rs +++ b/rust/src/nfs/types.rs @@ -16,165 +16,169 @@ */ /* RFC 1813, section '3. Server Procedures' */ -pub const NFSPROC3_NULL: u32 = 0; -pub const NFSPROC3_GETATTR: u32 = 1; -pub const NFSPROC3_SETATTR: u32 = 2; -pub const NFSPROC3_LOOKUP: u32 = 3; -pub const NFSPROC3_ACCESS: u32 = 4; -pub const NFSPROC3_READLINK: u32 = 5; -pub const NFSPROC3_READ: u32 = 6; -pub const NFSPROC3_WRITE: u32 = 7; -pub const NFSPROC3_CREATE: u32 = 8; -pub const NFSPROC3_MKDIR: u32 = 9; -pub const NFSPROC3_SYMLINK: u32 = 10; -pub const NFSPROC3_MKNOD: u32 = 11; -pub const NFSPROC3_REMOVE: u32 = 12; -pub const NFSPROC3_RMDIR: u32 = 13; -pub const NFSPROC3_RENAME: u32 = 14; -pub const NFSPROC3_LINK: u32 = 15; -pub const NFSPROC3_READDIR: u32 = 16; +pub const NFSPROC3_NULL: u32 = 0; +pub const NFSPROC3_GETATTR: u32 = 1; +pub const NFSPROC3_SETATTR: u32 = 2; +pub const NFSPROC3_LOOKUP: u32 = 3; +pub const NFSPROC3_ACCESS: u32 = 4; +pub const NFSPROC3_READLINK: u32 = 5; +pub const NFSPROC3_READ: u32 = 6; +pub const NFSPROC3_WRITE: u32 = 7; +pub const NFSPROC3_CREATE: u32 = 8; +pub const NFSPROC3_MKDIR: u32 = 9; +pub const NFSPROC3_SYMLINK: u32 = 10; +pub const NFSPROC3_MKNOD: u32 = 11; +pub const NFSPROC3_REMOVE: u32 = 12; +pub const NFSPROC3_RMDIR: u32 = 13; +pub const NFSPROC3_RENAME: u32 = 14; +pub const NFSPROC3_LINK: u32 = 15; +pub const NFSPROC3_READDIR: u32 = 16; pub const NFSPROC3_READDIRPLUS: u32 = 17; -pub const NFSPROC3_FSSTAT: u32 = 18; -pub const NFSPROC3_FSINFO: u32 = 19; -pub const NFSPROC3_PATHCONF: u32 = 20; -pub const NFSPROC3_COMMIT: u32 = 21; +pub const NFSPROC3_FSSTAT: u32 = 18; +pub const NFSPROC3_FSINFO: u32 = 19; +pub const NFSPROC3_PATHCONF: u32 = 20; +pub const NFSPROC3_COMMIT: u32 = 21; pub fn nfs3_procedure_string(procedure: u32) -> String { match procedure { - NFSPROC3_NULL => "NULL", - NFSPROC3_GETATTR => "GETATTR", - NFSPROC3_SETATTR => "SETATTR", - NFSPROC3_LOOKUP => "LOOKUP", - NFSPROC3_ACCESS => "ACCESS", - NFSPROC3_READLINK => "READLINK", - NFSPROC3_READ => "READ", - NFSPROC3_WRITE => "WRITE", - NFSPROC3_CREATE => "CREATE", - NFSPROC3_MKDIR => "MKDIR", - NFSPROC3_SYMLINK => "SYMLINK", - NFSPROC3_MKNOD => "MKNOD", - NFSPROC3_REMOVE => "REMOVE", - NFSPROC3_RMDIR => "RMDIR", - NFSPROC3_RENAME => "RENAME", - NFSPROC3_LINK => "LINK", - NFSPROC3_READDIR => "READDIR", - NFSPROC3_READDIRPLUS => "READDIRPLUS", - NFSPROC3_FSSTAT => "FSSTAT", - NFSPROC3_FSINFO => "FSINFO", - NFSPROC3_PATHCONF => "PATHCONF", - NFSPROC3_COMMIT => "COMMIT", + NFSPROC3_NULL => "NULL", + NFSPROC3_GETATTR => "GETATTR", + NFSPROC3_SETATTR => "SETATTR", + NFSPROC3_LOOKUP => "LOOKUP", + NFSPROC3_ACCESS => "ACCESS", + NFSPROC3_READLINK => "READLINK", + NFSPROC3_READ => "READ", + NFSPROC3_WRITE => "WRITE", + NFSPROC3_CREATE => "CREATE", + NFSPROC3_MKDIR => "MKDIR", + NFSPROC3_SYMLINK => "SYMLINK", + NFSPROC3_MKNOD => "MKNOD", + NFSPROC3_REMOVE => "REMOVE", + NFSPROC3_RMDIR => "RMDIR", + NFSPROC3_RENAME => "RENAME", + NFSPROC3_LINK => "LINK", + NFSPROC3_READDIR => "READDIR", + NFSPROC3_READDIRPLUS => "READDIRPLUS", + NFSPROC3_FSSTAT => "FSSTAT", + NFSPROC3_FSINFO => "FSINFO", + NFSPROC3_PATHCONF => "PATHCONF", + NFSPROC3_COMMIT => "COMMIT", _ => { return (procedure).to_string(); } - }.to_string() + } + .to_string() } /* RFC 1813, section '2.6 Defined Error Numbers' */ -pub const NFS3_OK: u32 = 0; -pub const NFS3ERR_PERM: u32 = 1; -pub const NFS3ERR_NOENT: u32 = 2; -pub const NFS3ERR_IO: u32 = 5; -pub const NFS3ERR_NXIO: u32 = 6; -pub const NFS3ERR_ACCES: u32 = 13; -pub const NFS3ERR_EXIST: u32 = 17; -pub const NFS3ERR_XDEV: u32 = 18; -pub const NFS3ERR_NODEV: u32 = 19; -pub const NFS3ERR_NOTDIR: u32 = 20; -pub const NFS3ERR_ISDIR: u32 = 21; -pub const NFS3ERR_INVAL: u32 = 22; -pub const NFS3ERR_FBIG: u32 = 27; -pub const NFS3ERR_NOSPC: u32 = 28; -pub const NFS3ERR_ROFS: u32 = 30; -pub const NFS3ERR_MLINK: u32 = 31; -pub const NFS3ERR_NAMETOOLONG: u32 = 63; -pub const NFS3ERR_NOTEMPTY: u32 = 66; -pub const NFS3ERR_DQUOT: u32 = 69; -pub const NFS3ERR_STALE: u32 = 70; -pub const NFS3ERR_REMOTE: u32 = 71; -pub const NFS3ERR_BADHANDLE: u32 = 10001; -pub const NFS3ERR_NOT_SYNC: u32 = 10002; -pub const NFS3ERR_BAD_COOKIE: u32 = 10003; -pub const NFS3ERR_NOTSUPP: u32 = 10004; -pub const NFS3ERR_TOOSMALL: u32 = 10005; -pub const NFS3ERR_SERVERFAULT: u32 = 10006; -pub const NFS3ERR_BADTYPE: u32 = 10007; -pub const NFS3ERR_JUKEBOX: u32 = 10008; +pub const NFS3_OK: u32 = 0; +pub const NFS3ERR_PERM: u32 = 1; +pub const NFS3ERR_NOENT: u32 = 2; +pub const NFS3ERR_IO: u32 = 5; +pub const NFS3ERR_NXIO: u32 = 6; +pub const NFS3ERR_ACCES: u32 = 13; +pub const NFS3ERR_EXIST: u32 = 17; +pub const NFS3ERR_XDEV: u32 = 18; +pub const NFS3ERR_NODEV: u32 = 19; +pub const NFS3ERR_NOTDIR: u32 = 20; +pub const NFS3ERR_ISDIR: u32 = 21; +pub const NFS3ERR_INVAL: u32 = 22; +pub const NFS3ERR_FBIG: u32 = 27; +pub const NFS3ERR_NOSPC: u32 = 28; +pub const NFS3ERR_ROFS: u32 = 30; +pub const NFS3ERR_MLINK: u32 = 31; +pub const NFS3ERR_NAMETOOLONG: u32 = 63; +pub const NFS3ERR_NOTEMPTY: u32 = 66; +pub const NFS3ERR_DQUOT: u32 = 69; +pub const NFS3ERR_STALE: u32 = 70; +pub const NFS3ERR_REMOTE: u32 = 71; +pub const NFS3ERR_BADHANDLE: u32 = 10001; +pub const NFS3ERR_NOT_SYNC: u32 = 10002; +pub const NFS3ERR_BAD_COOKIE: u32 = 10003; +pub const NFS3ERR_NOTSUPP: u32 = 10004; +pub const NFS3ERR_TOOSMALL: u32 = 10005; +pub const NFS3ERR_SERVERFAULT: u32 = 10006; +pub const NFS3ERR_BADTYPE: u32 = 10007; +pub const NFS3ERR_JUKEBOX: u32 = 10008; pub fn nfs3_status_string(status: u32) -> String { match status { - NFS3_OK => "OK", - NFS3ERR_PERM => "ERR_PERM", - NFS3ERR_NOENT => "ERR_NOENT", - NFS3ERR_IO => "ERR_IO", - NFS3ERR_NXIO => "ERR_NXIO", - NFS3ERR_ACCES => "ERR_ACCES", - NFS3ERR_EXIST => "ERR_EXIST", - NFS3ERR_XDEV => "ERR_XDEV", - NFS3ERR_NODEV => "ERR_NODEV", - NFS3ERR_NOTDIR => "ERR_NOTDIR", - NFS3ERR_ISDIR => "ERR_ISDIR", - NFS3ERR_INVAL => "ERR_INVAL", - NFS3ERR_FBIG => "ERR_FBIG", - NFS3ERR_NOSPC => "ERR_NOSPC", - NFS3ERR_ROFS => "ERR_ROFS", - NFS3ERR_MLINK => "ERR_MLINK", + NFS3_OK => "OK", + NFS3ERR_PERM => "ERR_PERM", + NFS3ERR_NOENT => "ERR_NOENT", + NFS3ERR_IO => "ERR_IO", + NFS3ERR_NXIO => "ERR_NXIO", + NFS3ERR_ACCES => "ERR_ACCES", + NFS3ERR_EXIST => "ERR_EXIST", + NFS3ERR_XDEV => "ERR_XDEV", + NFS3ERR_NODEV => "ERR_NODEV", + NFS3ERR_NOTDIR => "ERR_NOTDIR", + NFS3ERR_ISDIR => "ERR_ISDIR", + NFS3ERR_INVAL => "ERR_INVAL", + NFS3ERR_FBIG => "ERR_FBIG", + NFS3ERR_NOSPC => "ERR_NOSPC", + NFS3ERR_ROFS => "ERR_ROFS", + NFS3ERR_MLINK => "ERR_MLINK", NFS3ERR_NAMETOOLONG => "ERR_NAMETOOLONG", - NFS3ERR_NOTEMPTY => "ERR_NOTEMPTY", - NFS3ERR_DQUOT => "ERR_DQUOT", - NFS3ERR_STALE => "ERR_STALE", - NFS3ERR_REMOTE => "ERR_REMOTE", - NFS3ERR_BADHANDLE => "ERR_BADHANDLE", - NFS3ERR_NOT_SYNC => "ERR_NOT_SYNC", - NFS3ERR_BAD_COOKIE => "ERR_BAD_COOKIE", - NFS3ERR_NOTSUPP => "ERR_NOTSUPP", - NFS3ERR_TOOSMALL => "ERR_TOOSMALL", + NFS3ERR_NOTEMPTY => "ERR_NOTEMPTY", + NFS3ERR_DQUOT => "ERR_DQUOT", + NFS3ERR_STALE => "ERR_STALE", + NFS3ERR_REMOTE => "ERR_REMOTE", + NFS3ERR_BADHANDLE => "ERR_BADHANDLE", + NFS3ERR_NOT_SYNC => "ERR_NOT_SYNC", + NFS3ERR_BAD_COOKIE => "ERR_BAD_COOKIE", + NFS3ERR_NOTSUPP => "ERR_NOTSUPP", + NFS3ERR_TOOSMALL => "ERR_TOOSMALL", NFS3ERR_SERVERFAULT => "ERR_SERVERFAULT", - NFS3ERR_BADTYPE => "ERR_BADTYPE", - NFS3ERR_JUKEBOX => "ERR_JUKEBOX", + NFS3ERR_BADTYPE => "ERR_BADTYPE", + NFS3ERR_JUKEBOX => "ERR_JUKEBOX", _ => { return (status).to_string(); - }, - }.to_string() + } + } + .to_string() } -pub const RPCMSG_ACCEPTED: u32 = 0; -pub const RPCMSG_DENIED: u32 = 1; +pub const RPCMSG_ACCEPTED: u32 = 0; +pub const RPCMSG_DENIED: u32 = 1; pub fn rpc_status_string(status: u32) -> String { match status { RPCMSG_ACCEPTED => "ACCEPTED", - RPCMSG_DENIED => "DENIED", + RPCMSG_DENIED => "DENIED", _ => { return (status).to_string(); - }, - }.to_string() + } + } + .to_string() } /* http://www.iana.org/assignments/rpc-authentication-numbers/rpc-authentication-numbers.xhtml */ /* RFC 1057 Section 7.2 */ /* RFC 2203 Section 3 */ -pub const RPCAUTH_NULL: u32 = 0; -pub const RPCAUTH_UNIX: u32 = 1; -pub const RPCAUTH_SHORT: u32 = 2; -pub const RPCAUTH_DH: u32 = 3; -pub const RPCAUTH_KERB: u32 = 4; -pub const RPCAUTH_RSA: u32 = 5; -pub const RPCAUTH_GSS: u32 = 6; +pub const RPCAUTH_NULL: u32 = 0; +pub const RPCAUTH_UNIX: u32 = 1; +pub const RPCAUTH_SHORT: u32 = 2; +pub const RPCAUTH_DH: u32 = 3; +pub const RPCAUTH_KERB: u32 = 4; +pub const RPCAUTH_RSA: u32 = 5; +pub const RPCAUTH_GSS: u32 = 6; pub fn rpc_auth_type_string(auth_type: u32) -> String { match auth_type { - RPCAUTH_NULL => "NULL", - RPCAUTH_UNIX => "UNIX", - RPCAUTH_SHORT => "SHORT", - RPCAUTH_DH => "DH", - RPCAUTH_KERB => "KERB", - RPCAUTH_RSA => "RSA", - RPCAUTH_GSS => "GSS", + RPCAUTH_NULL => "NULL", + RPCAUTH_UNIX => "UNIX", + RPCAUTH_SHORT => "SHORT", + RPCAUTH_DH => "DH", + RPCAUTH_KERB => "KERB", + RPCAUTH_RSA => "RSA", + RPCAUTH_GSS => "GSS", _ => { return (auth_type).to_string(); - }, - }.to_string() + } + } + .to_string() } pub fn rpc_auth_type_known(auth_type: u32) -> i8 { @@ -185,109 +189,107 @@ pub fn rpc_auth_type_known(auth_type: u32) -> i8 { return -1; } - -pub const NFSPROC4_NULL: u32 = 0; -pub const NFSPROC4_COMPOUND: u32 = 1; +pub const NFSPROC4_NULL: u32 = 0; +pub const NFSPROC4_COMPOUND: u32 = 1; /* ops */ -pub const NFSPROC4_ACCESS: u32 = 3; -pub const NFSPROC4_CLOSE: u32 = 4; -pub const NFSPROC4_COMMIT: u32 = 5; -pub const NFSPROC4_CREATE: u32 = 6; -pub const NFSPROC4_DELEGPURGE: u32 = 7; -pub const NFSPROC4_DELEGRETURN: u32 = 8; -pub const NFSPROC4_GETATTR: u32 = 9; -pub const NFSPROC4_GETFH: u32 = 10; -pub const NFSPROC4_LINK: u32 = 11; -pub const NFSPROC4_LOCK: u32 = 12; -pub const NFSPROC4_LOCKT: u32 = 13; -pub const NFSPROC4_LOCKU: u32 = 14; -pub const NFSPROC4_LOOKUP: u32 = 15; -pub const NFSPROC4_LOOKUPP: u32 = 16; -pub const NFSPROC4_NVERIFY: u32 = 17; -pub const NFSPROC4_OPEN: u32 = 18; -pub const NFSPROC4_OPENATTR: u32 = 19; -pub const NFSPROC4_OPEN_CONFIRM: u32 = 20; -pub const NFSPROC4_OPEN_DOWNGRADE: u32 = 21; -pub const NFSPROC4_PUTFH: u32 = 22; -pub const NFSPROC4_PUTPUBFH: u32 = 23; -pub const NFSPROC4_PUTROOTFH: u32 = 24; -pub const NFSPROC4_READ: u32 = 25; -pub const NFSPROC4_READDIR: u32 = 26; -pub const NFSPROC4_READLINK: u32 = 27; -pub const NFSPROC4_REMOVE: u32 = 28; -pub const NFSPROC4_RENAME: u32 = 29; -pub const NFSPROC4_RENEW: u32 = 30; -pub const NFSPROC4_RESTOREFH: u32 = 31; -pub const NFSPROC4_SAVEFH: u32 = 32; -pub const NFSPROC4_SECINFO: u32 = 33; -pub const NFSPROC4_SETATTR: u32 = 34; -pub const NFSPROC4_SETCLIENTID: u32 = 35; +pub const NFSPROC4_ACCESS: u32 = 3; +pub const NFSPROC4_CLOSE: u32 = 4; +pub const NFSPROC4_COMMIT: u32 = 5; +pub const NFSPROC4_CREATE: u32 = 6; +pub const NFSPROC4_DELEGPURGE: u32 = 7; +pub const NFSPROC4_DELEGRETURN: u32 = 8; +pub const NFSPROC4_GETATTR: u32 = 9; +pub const NFSPROC4_GETFH: u32 = 10; +pub const NFSPROC4_LINK: u32 = 11; +pub const NFSPROC4_LOCK: u32 = 12; +pub const NFSPROC4_LOCKT: u32 = 13; +pub const NFSPROC4_LOCKU: u32 = 14; +pub const NFSPROC4_LOOKUP: u32 = 15; +pub const NFSPROC4_LOOKUPP: u32 = 16; +pub const NFSPROC4_NVERIFY: u32 = 17; +pub const NFSPROC4_OPEN: u32 = 18; +pub const NFSPROC4_OPENATTR: u32 = 19; +pub const NFSPROC4_OPEN_CONFIRM: u32 = 20; +pub const NFSPROC4_OPEN_DOWNGRADE: u32 = 21; +pub const NFSPROC4_PUTFH: u32 = 22; +pub const NFSPROC4_PUTPUBFH: u32 = 23; +pub const NFSPROC4_PUTROOTFH: u32 = 24; +pub const NFSPROC4_READ: u32 = 25; +pub const NFSPROC4_READDIR: u32 = 26; +pub const NFSPROC4_READLINK: u32 = 27; +pub const NFSPROC4_REMOVE: u32 = 28; +pub const NFSPROC4_RENAME: u32 = 29; +pub const NFSPROC4_RENEW: u32 = 30; +pub const NFSPROC4_RESTOREFH: u32 = 31; +pub const NFSPROC4_SAVEFH: u32 = 32; +pub const NFSPROC4_SECINFO: u32 = 33; +pub const NFSPROC4_SETATTR: u32 = 34; +pub const NFSPROC4_SETCLIENTID: u32 = 35; pub const NFSPROC4_SETCLIENTID_CONFIRM: u32 = 36; -pub const NFSPROC4_VERIFY: u32 = 37; -pub const NFSPROC4_WRITE: u32 = 38; -pub const NFSPROC4_RELEASE_LOCKOWNER: u32 = 39; -pub const NFSPROC4_EXCHANGE_ID: u32 = 42; -pub const NFSPROC4_CREATE_SESSION: u32 = 43; -pub const NFSPROC4_DESTROY_SESSION: u32 = 44; -pub const NFSPROC4_GETDEVINFO: u32 = 47; -pub const NFSPROC4_LAYOUTGET: u32 = 50; -pub const NFSPROC4_LAYOUTRETURN: u32 = 51; -pub const NFSPROC4_SECINFO_NO_NAME: u32 = 52; -pub const NFSPROC4_SEQUENCE: u32 = 53; -pub const NFSPROC4_DESTROY_CLIENTID: u32 = 57; -pub const NFSPROC4_RECLAIM_COMPLETE: u32 = 58; - -pub const NFSPROC4_ILLEGAL: u32 = 10044; +pub const NFSPROC4_VERIFY: u32 = 37; +pub const NFSPROC4_WRITE: u32 = 38; +pub const NFSPROC4_RELEASE_LOCKOWNER: u32 = 39; +pub const NFSPROC4_EXCHANGE_ID: u32 = 42; +pub const NFSPROC4_CREATE_SESSION: u32 = 43; +pub const NFSPROC4_DESTROY_SESSION: u32 = 44; +pub const NFSPROC4_GETDEVINFO: u32 = 47; +pub const NFSPROC4_LAYOUTGET: u32 = 50; +pub const NFSPROC4_LAYOUTRETURN: u32 = 51; +pub const NFSPROC4_SECINFO_NO_NAME: u32 = 52; +pub const NFSPROC4_SEQUENCE: u32 = 53; +pub const NFSPROC4_DESTROY_CLIENTID: u32 = 57; +pub const NFSPROC4_RECLAIM_COMPLETE: u32 = 58; +pub const NFSPROC4_ILLEGAL: u32 = 10044; pub fn nfs4_procedure_string(procedure: u32) -> String { match procedure { - NFSPROC4_COMPOUND => "COMPOUND", - NFSPROC4_NULL => "NULL", + NFSPROC4_COMPOUND => "COMPOUND", + NFSPROC4_NULL => "NULL", // ops - NFSPROC4_ACCESS => "ACCESS", - NFSPROC4_CLOSE => "CLOSE", - NFSPROC4_COMMIT => "COMMIT", - NFSPROC4_CREATE => "CREATE", - NFSPROC4_DELEGPURGE => "DELEGPURGE", - NFSPROC4_DELEGRETURN => "DELEGRETURN", - NFSPROC4_GETATTR => "GETATTR", - NFSPROC4_GETFH => "GETFH", - NFSPROC4_LINK => "LINK", - NFSPROC4_LOCK => "LOCK", - NFSPROC4_LOCKT => "LOCKT", - NFSPROC4_LOCKU => "LOCKU", - NFSPROC4_LOOKUP => "LOOKUP", - NFSPROC4_LOOKUPP => "LOOKUPP", - NFSPROC4_NVERIFY => "NVERIFY", - NFSPROC4_OPEN => "OPEN", - NFSPROC4_OPENATTR => "OPENATTR", - NFSPROC4_OPEN_CONFIRM => "OPEN_CONFIRM", - NFSPROC4_OPEN_DOWNGRADE => "OPEN_DOWNGRADE", - NFSPROC4_PUTFH => "PUTFH", - NFSPROC4_PUTPUBFH => "PUTPUBFH", - NFSPROC4_PUTROOTFH => "PUTROOTFH", - NFSPROC4_READ => "READ", - NFSPROC4_READDIR => "READDIR", - NFSPROC4_READLINK => "READLINK", - NFSPROC4_REMOVE => "REMOVE", - NFSPROC4_RENAME => "RENAME", - NFSPROC4_RENEW => "RENEW", - NFSPROC4_RESTOREFH => "RESTOREFH", - NFSPROC4_SAVEFH => "SAVEFH", - NFSPROC4_SECINFO => "SECINFO", - NFSPROC4_SETATTR => "SETATTR", - NFSPROC4_SETCLIENTID => "SETCLIENTID", - NFSPROC4_SETCLIENTID_CONFIRM => "SETCLIENTID_CONFIRM", - NFSPROC4_VERIFY => "VERIFY", - NFSPROC4_WRITE => "WRITE", - NFSPROC4_RELEASE_LOCKOWNER => "RELEASE_LOCKOWNER", - NFSPROC4_ILLEGAL => "ILLEGAL", + NFSPROC4_ACCESS => "ACCESS", + NFSPROC4_CLOSE => "CLOSE", + NFSPROC4_COMMIT => "COMMIT", + NFSPROC4_CREATE => "CREATE", + NFSPROC4_DELEGPURGE => "DELEGPURGE", + NFSPROC4_DELEGRETURN => "DELEGRETURN", + NFSPROC4_GETATTR => "GETATTR", + NFSPROC4_GETFH => "GETFH", + NFSPROC4_LINK => "LINK", + NFSPROC4_LOCK => "LOCK", + NFSPROC4_LOCKT => "LOCKT", + NFSPROC4_LOCKU => "LOCKU", + NFSPROC4_LOOKUP => "LOOKUP", + NFSPROC4_LOOKUPP => "LOOKUPP", + NFSPROC4_NVERIFY => "NVERIFY", + NFSPROC4_OPEN => "OPEN", + NFSPROC4_OPENATTR => "OPENATTR", + NFSPROC4_OPEN_CONFIRM => "OPEN_CONFIRM", + NFSPROC4_OPEN_DOWNGRADE => "OPEN_DOWNGRADE", + NFSPROC4_PUTFH => "PUTFH", + NFSPROC4_PUTPUBFH => "PUTPUBFH", + NFSPROC4_PUTROOTFH => "PUTROOTFH", + NFSPROC4_READ => "READ", + NFSPROC4_READDIR => "READDIR", + NFSPROC4_READLINK => "READLINK", + NFSPROC4_REMOVE => "REMOVE", + NFSPROC4_RENAME => "RENAME", + NFSPROC4_RENEW => "RENEW", + NFSPROC4_RESTOREFH => "RESTOREFH", + NFSPROC4_SAVEFH => "SAVEFH", + NFSPROC4_SECINFO => "SECINFO", + NFSPROC4_SETATTR => "SETATTR", + NFSPROC4_SETCLIENTID => "SETCLIENTID", + NFSPROC4_SETCLIENTID_CONFIRM => "SETCLIENTID_CONFIRM", + NFSPROC4_VERIFY => "VERIFY", + NFSPROC4_WRITE => "WRITE", + NFSPROC4_RELEASE_LOCKOWNER => "RELEASE_LOCKOWNER", + NFSPROC4_ILLEGAL => "ILLEGAL", _ => { return (procedure).to_string(); } - }.to_string() + } + .to_string() } -pub const NFS4_OK: u32 = 0; - +pub const NFS4_OK: u32 = 0; diff --git a/rust/src/ntp/ntp.rs b/rust/src/ntp/ntp.rs index c7b3b3d01826..71b94d72adfa 100644 --- a/rust/src/ntp/ntp.rs +++ b/rust/src/ntp/ntp.rs @@ -19,9 +19,9 @@ extern crate ntp_parser; use self::ntp_parser::*; -use crate::core; -use crate::core::{AppProto,Flow,ALPROTO_UNKNOWN,ALPROTO_FAILED,Direction}; use crate::applayer::{self, *}; +use crate::core; +use crate::core::{AppProto, Direction, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN}; use std; use std::ffi::CString; @@ -29,7 +29,7 @@ use nom7::Err; #[derive(AppLayerEvent)] pub enum NTPEvent { - UnsolicitedResponse , + UnsolicitedResponse, MalformedData, NotRequest, NotResponse, @@ -88,7 +88,7 @@ impl NTPState { /// Returns 0 if successful, or -1 on error fn parse(&mut self, i: &[u8], direction: Direction) -> i32 { match parse_ntp(i) { - Ok((_,ref msg)) => { + Ok((_, ref msg)) => { // SCLogDebug!("parse_ntp: {:?}",msg); let (mode, ref_id) = match msg { NtpPacket::V3(pkt) => (pkt.mode, pkt.ref_id), @@ -101,17 +101,17 @@ impl NTPState { self.transactions.push(tx); } 0 - }, + } Err(Err::Incomplete(_)) => { SCLogDebug!("Insufficient data while parsing NTP data"); self.set_event(NTPEvent::MalformedData); -1 - }, + } Err(_) => { SCLogDebug!("Error while parsing NTP data"); self.set_event(NTPEvent::MalformedData); -1 - }, + } } } @@ -159,7 +159,9 @@ impl NTPTransaction { /// Returns *mut NTPState #[no_mangle] -pub extern "C" fn rs_ntp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_ntp_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = NTPState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; @@ -168,19 +170,17 @@ pub extern "C" fn rs_ntp_state_new(_orig_state: *mut std::os::raw::c_void, _orig /// Params: /// - state: *mut NTPState as void pointer #[no_mangle] -pub extern "C" fn rs_ntp_state_free(state: *mut std::os::raw::c_void) { - let mut ntp_state = unsafe{ Box::from_raw(state as *mut NTPState) }; +pub extern fn rs_ntp_state_free(state: *mut std::os::raw::c_void) { + let mut ntp_state = unsafe { Box::from_raw(state as *mut NTPState) }; ntp_state.free(); } #[no_mangle] -pub unsafe extern "C" fn rs_ntp_parse_request(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { - let state = cast_pointer!(state,NTPState); +pub unsafe extern fn rs_ntp_parse_request( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { + let state = cast_pointer!(state, NTPState); if state.parse(stream_slice.as_slice(), Direction::ToServer) < 0 { return AppLayerResult::err(); } @@ -188,13 +188,11 @@ pub unsafe extern "C" fn rs_ntp_parse_request(_flow: *const core::Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_ntp_parse_response(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { - let state = cast_pointer!(state,NTPState); +pub unsafe extern fn rs_ntp_parse_response( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { + let state = cast_pointer!(state, NTPState); if state.parse(stream_slice.as_slice(), Direction::ToClient) < 0 { return AppLayerResult::err(); } @@ -202,102 +200,94 @@ pub unsafe extern "C" fn rs_ntp_parse_response(_flow: *const core::Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_ntp_state_get_tx(state: *mut std::os::raw::c_void, - tx_id: u64) - -> *mut std::os::raw::c_void -{ - let state = cast_pointer!(state,NTPState); +pub unsafe extern fn rs_ntp_state_get_tx( + state: *mut std::os::raw::c_void, tx_id: u64, +) -> *mut std::os::raw::c_void { + let state = cast_pointer!(state, NTPState); match state.get_tx_by_id(tx_id) { Some(tx) => tx as *const _ as *mut _, - None => std::ptr::null_mut(), + None => std::ptr::null_mut(), } } #[no_mangle] -pub unsafe extern "C" fn rs_ntp_state_get_tx_count(state: *mut std::os::raw::c_void) - -> u64 -{ - let state = cast_pointer!(state,NTPState); +pub unsafe extern fn rs_ntp_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { + let state = cast_pointer!(state, NTPState); state.tx_id } #[no_mangle] -pub unsafe extern "C" fn rs_ntp_state_tx_free(state: *mut std::os::raw::c_void, - tx_id: u64) -{ - let state = cast_pointer!(state,NTPState); +pub unsafe extern fn rs_ntp_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { + let state = cast_pointer!(state, NTPState); state.free_tx(tx_id); } #[no_mangle] -pub extern "C" fn rs_ntp_tx_get_alstate_progress(_tx: *mut std::os::raw::c_void, - _direction: u8) - -> std::os::raw::c_int -{ +pub extern fn rs_ntp_tx_get_alstate_progress( + _tx: *mut std::os::raw::c_void, _direction: u8, +) -> std::os::raw::c_int { 1 } -static mut ALPROTO_NTP : AppProto = ALPROTO_UNKNOWN; +static mut ALPROTO_NTP: AppProto = ALPROTO_UNKNOWN; #[no_mangle] -pub extern "C" fn ntp_probing_parser(_flow: *const Flow, - _direction: u8, - input:*const u8, input_len: u32, - _rdir: *mut u8) -> AppProto -{ +pub extern fn ntp_probing_parser( + _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, +) -> AppProto { let slice: &[u8] = unsafe { std::slice::from_raw_parts(input as *mut u8, input_len as usize) }; - let alproto = unsafe{ ALPROTO_NTP }; + let alproto = unsafe { ALPROTO_NTP }; match parse_ntp(slice) { Ok((_, _)) => { // parse_ntp already checks for supported version (3 or 4) return alproto; - }, + } Err(Err::Incomplete(_)) => { return ALPROTO_UNKNOWN; - }, + } Err(_) => { - return unsafe{ALPROTO_FAILED}; - }, + return unsafe { ALPROTO_FAILED }; + } } } export_tx_data_get!(rs_ntp_get_tx_data, NTPTransaction); export_state_data_get!(rs_ntp_get_state_data, NTPState); -const PARSER_NAME : &[u8] = b"ntp\0"; +const PARSER_NAME: &[u8] = b"ntp\0"; #[no_mangle] -pub unsafe extern "C" fn rs_register_ntp_parser() { +pub unsafe extern fn rs_register_ntp_parser() { let default_port = CString::new("123").unwrap(); let parser = RustParser { - name : PARSER_NAME.as_ptr() as *const std::os::raw::c_char, - default_port : default_port.as_ptr(), - ipproto : core::IPPROTO_UDP, - probe_ts : Some(ntp_probing_parser), - probe_tc : Some(ntp_probing_parser), - min_depth : 0, - max_depth : 16, - state_new : rs_ntp_state_new, - state_free : rs_ntp_state_free, - tx_free : rs_ntp_state_tx_free, - parse_ts : rs_ntp_parse_request, - parse_tc : rs_ntp_parse_response, - get_tx_count : rs_ntp_state_get_tx_count, - get_tx : rs_ntp_state_get_tx, - tx_comp_st_ts : 1, - tx_comp_st_tc : 1, - tx_get_progress : rs_ntp_tx_get_alstate_progress, - get_eventinfo : Some(NTPEvent::get_event_info), - get_eventinfo_byid : Some(NTPEvent::get_event_info_by_id), - localstorage_new : None, - localstorage_free : None, - get_tx_files : None, - get_tx_iterator : Some(applayer::state_get_tx_iterator::), - get_tx_data : rs_ntp_get_tx_data, - get_state_data : rs_ntp_get_state_data, - apply_tx_config : None, - flags : 0, - truncate : None, + name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, + default_port: default_port.as_ptr(), + ipproto: core::IPPROTO_UDP, + probe_ts: Some(ntp_probing_parser), + probe_tc: Some(ntp_probing_parser), + min_depth: 0, + max_depth: 16, + state_new: rs_ntp_state_new, + state_free: rs_ntp_state_free, + tx_free: rs_ntp_state_tx_free, + parse_ts: rs_ntp_parse_request, + parse_tc: rs_ntp_parse_response, + get_tx_count: rs_ntp_state_get_tx_count, + get_tx: rs_ntp_state_get_tx, + tx_comp_st_ts: 1, + tx_comp_st_tc: 1, + tx_get_progress: rs_ntp_tx_get_alstate_progress, + get_eventinfo: Some(NTPEvent::get_event_info), + get_eventinfo_byid: Some(NTPEvent::get_event_info_by_id), + localstorage_new: None, + localstorage_free: None, + get_tx_files: None, + get_tx_iterator: Some(applayer::state_get_tx_iterator::), + get_tx_data: rs_ntp_get_tx_data, + get_state_data: rs_ntp_get_state_data, + apply_tx_config: None, + flags: 0, + truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; @@ -315,7 +305,6 @@ pub unsafe extern "C" fn rs_register_ntp_parser() { } } - #[cfg(test)] mod tests { use super::*; @@ -323,13 +312,11 @@ mod tests { #[test] fn test_ntp_parse_request_valid() { // A UDP NTP v4 request, in client mode - const REQ : &[u8] = &[ - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x57, 0xab, 0xc3, 0x4a, 0x5f, 0x2c, 0xfe + const REQ: &[u8] = &[ + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x57, + 0xab, 0xc3, 0x4a, 0x5f, 0x2c, 0xfe, ]; let mut state = NTPState::new(); diff --git a/rust/src/pgsql/logger.rs b/rust/src/pgsql/logger.rs index 03b1ad0f4677..e10dea758fc0 100644 --- a/rust/src/pgsql/logger.rs +++ b/rust/src/pgsql/logger.rs @@ -278,7 +278,7 @@ fn log_pgsql_param(param: &PgsqlParameter) -> Result { } #[no_mangle] -pub unsafe extern "C" fn rs_pgsql_logger( +pub unsafe extern fn rs_pgsql_logger( tx: *mut std::os::raw::c_void, flags: u32, js: &mut JsonBuilder, ) -> bool { let tx_pgsql = cast_pointer!(tx, PgsqlTransaction); diff --git a/rust/src/pgsql/parser.rs b/rust/src/pgsql/parser.rs index ae07d5d5a078..e73ceb8e912d 100644 --- a/rust/src/pgsql/parser.rs +++ b/rust/src/pgsql/parser.rs @@ -275,7 +275,7 @@ impl PgsqlBEMessage { } PgsqlBEMessage::ConsolidatedDataRow(_) => "data_row", PgsqlBEMessage::NotificationResponse(_) => "notification_response", - PgsqlBEMessage::UnknownMessageType(_) => "unknown_message_type" + PgsqlBEMessage::UnknownMessageType(_) => "unknown_message_type", } } @@ -520,16 +520,25 @@ fn pgsql_parse_generic_parameter(i: &[u8]) -> IResult<&[u8], PgsqlParameter> { let (i, _) = tag("\x00")(i)?; let (i, param_value) = take_until("\x00")(i)?; let (i, _) = tag("\x00")(i)?; - Ok((i, PgsqlParameter { - name: PgsqlParameters::from(param_name), - value: param_value.to_vec(), - })) + Ok(( + i, + PgsqlParameter { + name: PgsqlParameters::from(param_name), + value: param_value.to_vec(), + }, + )) } pub fn pgsql_parse_startup_parameters(i: &[u8]) -> IResult<&[u8], PgsqlStartupParameters> { - let (i, mut optional) = opt(terminated(many1(pgsql_parse_generic_parameter), tag("\x00")))(i)?; + let (i, mut optional) = opt(terminated( + many1(pgsql_parse_generic_parameter), + tag("\x00"), + ))(i)?; if let Some(ref mut params) = optional { - let mut user = PgsqlParameter{name: PgsqlParameters::User, value: Vec::new() }; + let mut user = PgsqlParameter { + name: PgsqlParameters::User, + value: Vec::new(), + }; let mut index: usize = 0; for (j, p) in params.iter().enumerate() { if p.name == PgsqlParameters::User { @@ -541,17 +550,20 @@ pub fn pgsql_parse_startup_parameters(i: &[u8]) -> IResult<&[u8], PgsqlStartupPa if user.value.is_empty() { return Err(Err::Error(make_error(i, ErrorKind::Tag))); } - return Ok((i, PgsqlStartupParameters{ - user, - optional_params: if !params.is_empty() { - optional - } else { None }, - })); + return Ok(( + i, + PgsqlStartupParameters { + user, + optional_params: if !params.is_empty() { optional } else { None }, + }, + )); } return Err(Err::Error(make_error(i, ErrorKind::Tag))); } -fn parse_sasl_initial_response_payload(i: &[u8]) -> IResult<&[u8], (SASLAuthenticationMechanism, u32, Vec)> { +fn parse_sasl_initial_response_payload( + i: &[u8], +) -> IResult<&[u8], (SASLAuthenticationMechanism, u32, Vec)> { let (i, sasl_mechanism) = parse_sasl_mechanism(i)?; let (i, param_length) = be_u32(i)?; // From RFC 5802 - the client-first-message will always start w/ @@ -563,27 +575,31 @@ fn parse_sasl_initial_response_payload(i: &[u8]) -> IResult<&[u8], (SASLAuthenti pub fn parse_sasl_initial_response(i: &[u8]) -> IResult<&[u8], PgsqlFEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'p')(i)?; let (i, length) = verify(be_u32, |&x| x > PGSQL_LENGTH_FIELD)(i)?; - let (i, payload) = map_parser(take(length - PGSQL_LENGTH_FIELD), parse_sasl_initial_response_payload)(i)?; - Ok((i, PgsqlFEMessage::SASLInitialResponse( - SASLInitialResponsePacket { - identifier, - length, - auth_mechanism: payload.0, - param_length: payload.1, - sasl_param: payload.2, - }))) + let (i, payload) = map_parser( + take(length - PGSQL_LENGTH_FIELD), + parse_sasl_initial_response_payload, + )(i)?; + Ok(( + i, + PgsqlFEMessage::SASLInitialResponse(SASLInitialResponsePacket { + identifier, + length, + auth_mechanism: payload.0, + param_length: payload.1, + sasl_param: payload.2, + }), + )) } pub fn parse_sasl_response(i: &[u8]) -> IResult<&[u8], PgsqlFEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'p')(i)?; let (i, length) = verify(be_u32, |&x| x > PGSQL_LENGTH_FIELD)(i)?; let (i, payload) = take(length - PGSQL_LENGTH_FIELD)(i)?; - let resp = PgsqlFEMessage::SASLResponse( - RegularPacket { - identifier, - length, - payload: payload.to_vec(), - }); + let resp = PgsqlFEMessage::SASLResponse(RegularPacket { + identifier, + length, + payload: payload.to_vec(), + }); Ok((i, resp)) } @@ -591,33 +607,40 @@ pub fn pgsql_parse_startup_packet(i: &[u8]) -> IResult<&[u8], PgsqlFEMessage> { let (i, len) = verify(be_u32, |&x| x >= 8)(i)?; let (i, proto_major) = peek(be_u16)(i)?; let (i, b) = take(len - PGSQL_LENGTH_FIELD)(i)?; - let (_, message) = - match proto_major { - 1..=3 => { - let (b, proto_major) = be_u16(b)?; - let (b, proto_minor) = be_u16(b)?; - let (b, params) = pgsql_parse_startup_parameters(b)?; - (b, PgsqlFEMessage::StartupMessage(StartupPacket{ + let (_, message) = match proto_major { + 1..=3 => { + let (b, proto_major) = be_u16(b)?; + let (b, proto_minor) = be_u16(b)?; + let (b, params) = pgsql_parse_startup_parameters(b)?; + ( + b, + PgsqlFEMessage::StartupMessage(StartupPacket { length: len, proto_major, proto_minor, - params})) - }, - PGSQL_DUMMY_PROTO_MAJOR => { - let (b, proto_major) = be_u16(b)?; - let (b, proto_minor) = all_consuming(be_u16)(b)?; - let _message = match proto_minor { - PGSQL_DUMMY_PROTO_MINOR_SSL => (len, proto_major, proto_minor), - _ => return Err(Err::Error(make_error(b, ErrorKind::Switch))), - }; - - (b, PgsqlFEMessage::SSLRequest(DummyStartupPacket{ + params, + }), + ) + } + PGSQL_DUMMY_PROTO_MAJOR => { + let (b, proto_major) = be_u16(b)?; + let (b, proto_minor) = all_consuming(be_u16)(b)?; + let _message = match proto_minor { + PGSQL_DUMMY_PROTO_MINOR_SSL => (len, proto_major, proto_minor), + _ => return Err(Err::Error(make_error(b, ErrorKind::Switch))), + }; + + ( + b, + PgsqlFEMessage::SSLRequest(DummyStartupPacket { length: len, proto_major, - proto_minor})) - } - _ => return Err(Err::Error(make_error(b, ErrorKind::Switch))), - }; + proto_minor, + }), + ) + } + _ => return Err(Err::Error(make_error(b, ErrorKind::Switch))), + }; Ok((i, message)) } @@ -637,33 +660,38 @@ pub fn pgsql_parse_startup_packet(i: &[u8]) -> IResult<&[u8], PgsqlFEMessage> { pub fn parse_password_message(i: &[u8]) -> IResult<&[u8], PgsqlFEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'p')(i)?; let (i, length) = verify(be_u32, |&x| x >= PGSQL_LENGTH_FIELD)(i)?; - let (i, password) = map_parser( - take(length - PGSQL_LENGTH_FIELD), - take_until1("\x00") - )(i)?; - Ok((i, PgsqlFEMessage::PasswordMessage( - RegularPacket{ - identifier, - length, - payload: password.to_vec(), - }))) + let (i, password) = map_parser(take(length - PGSQL_LENGTH_FIELD), take_until1("\x00"))(i)?; + Ok(( + i, + PgsqlFEMessage::PasswordMessage(RegularPacket { + identifier, + length, + payload: password.to_vec(), + }), + )) } fn parse_simple_query(i: &[u8]) -> IResult<&[u8], PgsqlFEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'Q')(i)?; let (i, length) = verify(be_u32, |&x| x > PGSQL_LENGTH_FIELD)(i)?; let (i, query) = map_parser(take(length - PGSQL_LENGTH_FIELD), take_until1("\x00"))(i)?; - Ok((i, PgsqlFEMessage::SimpleQuery(RegularPacket { - identifier, - length, - payload: query.to_vec(), - }))) + Ok(( + i, + PgsqlFEMessage::SimpleQuery(RegularPacket { + identifier, + length, + payload: query.to_vec(), + }), + )) } fn parse_terminate_message(i: &[u8]) -> IResult<&[u8], PgsqlFEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'X')(i)?; let (i, length) = verify(be_u32, |&x| x == PGSQL_LENGTH_FIELD)(i)?; - Ok((i, PgsqlFEMessage::Terminate(TerminationMessage { identifier, length }))) + Ok(( + i, + PgsqlFEMessage::Terminate(TerminationMessage { identifier, length }), + )) } // Messages that begin with 'p' but are not password ones are not parsed here @@ -683,97 +711,114 @@ fn pgsql_parse_authentication_message<'a>(i: &'a [u8]) -> IResult<&'a [u8], Pgsq let (i, length) = verify(be_u32, |&x| x >= 8)(i)?; let (i, auth_type) = be_u32(i)?; let (i, payload) = peek(rest)(i)?; - let (i, message) = map_parser( - take(length - 8), - |b: &'a [u8]| { - match auth_type { - 0 => Ok((b, PgsqlBEMessage::AuthenticationOk( - AuthenticationMessage { - identifier, - length, - auth_type, - payload: payload.to_vec(), - }))), - 3 => Ok((b, PgsqlBEMessage::AuthenticationCleartextPassword( - AuthenticationMessage { - identifier, - length, - auth_type, - payload: payload.to_vec(), - }))), - 5 => { - let (b, salt) = all_consuming(take(4_usize))(b)?; - Ok((b, PgsqlBEMessage::AuthenticationMD5Password( - AuthenticationMessage { - identifier, - length, - auth_type, - payload: salt.to_vec(), - }))) - } - 9 => Ok((b, PgsqlBEMessage::AuthenticationSSPI( - AuthenticationMessage { - identifier, - length, - auth_type, - payload: payload.to_vec(), - }))), - // TODO - For SASL, should we parse specific details of the challenge itself? (as seen in: https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/postgres/message/authentication.rs ) - 10 => { - let (b, auth_mechanisms) = parse_sasl_mechanisms(b)?; - Ok((b, PgsqlBEMessage::AuthenticationSASL( - AuthenticationSASLMechanismMessage { - identifier, - length, - auth_type, - auth_mechanisms, - }))) - } - 11 => { - let (b, sasl_challenge) = rest(i)?; - Ok((b, PgsqlBEMessage::AuthenticationSASLContinue( - AuthenticationMessage { - identifier, - length, - auth_type, - payload: sasl_challenge.to_vec(), - }))) - }, - 12 => { - let (i, signature) = take(length - 8)(i)?; - Ok((i, PgsqlBEMessage::AuthenticationSASLFinal( - AuthenticationMessage { - identifier, - length, - auth_type, - payload: signature.to_vec(), - } - ))) - } - // TODO add other authentication messages - _ => return Err(Err::Error(make_error(i, ErrorKind::Switch))), - } + let (i, message) = map_parser(take(length - 8), |b: &'a [u8]| { + match auth_type { + 0 => Ok(( + b, + PgsqlBEMessage::AuthenticationOk(AuthenticationMessage { + identifier, + length, + auth_type, + payload: payload.to_vec(), + }), + )), + 3 => Ok(( + b, + PgsqlBEMessage::AuthenticationCleartextPassword(AuthenticationMessage { + identifier, + length, + auth_type, + payload: payload.to_vec(), + }), + )), + 5 => { + let (b, salt) = all_consuming(take(4_usize))(b)?; + Ok(( + b, + PgsqlBEMessage::AuthenticationMD5Password(AuthenticationMessage { + identifier, + length, + auth_type, + payload: salt.to_vec(), + }), + )) + } + 9 => Ok(( + b, + PgsqlBEMessage::AuthenticationSSPI(AuthenticationMessage { + identifier, + length, + auth_type, + payload: payload.to_vec(), + }), + )), + // TODO - For SASL, should we parse specific details of the challenge itself? (as seen in: https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/postgres/message/authentication.rs ) + 10 => { + let (b, auth_mechanisms) = parse_sasl_mechanisms(b)?; + Ok(( + b, + PgsqlBEMessage::AuthenticationSASL(AuthenticationSASLMechanismMessage { + identifier, + length, + auth_type, + auth_mechanisms, + }), + )) + } + 11 => { + let (b, sasl_challenge) = rest(i)?; + Ok(( + b, + PgsqlBEMessage::AuthenticationSASLContinue(AuthenticationMessage { + identifier, + length, + auth_type, + payload: sasl_challenge.to_vec(), + }), + )) + } + 12 => { + let (i, signature) = take(length - 8)(i)?; + Ok(( + i, + PgsqlBEMessage::AuthenticationSASLFinal(AuthenticationMessage { + identifier, + length, + auth_type, + payload: signature.to_vec(), + }), + )) + } + // TODO add other authentication messages + _ => return Err(Err::Error(make_error(i, ErrorKind::Switch))), } - )(i)?; + })(i)?; Ok((i, message)) } fn parse_parameter_status_message(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'S')(i)?; let (i, length) = verify(be_u32, |&x| x >= PGSQL_LENGTH_FIELD)(i)?; - let (i, param) = map_parser(take(length - PGSQL_LENGTH_FIELD), pgsql_parse_generic_parameter)(i)?; - Ok((i, PgsqlBEMessage::ParameterStatus(ParameterStatusMessage { - identifier, - length, - param, - }))) + let (i, param) = map_parser( + take(length - PGSQL_LENGTH_FIELD), + pgsql_parse_generic_parameter, + )(i)?; + Ok(( + i, + PgsqlBEMessage::ParameterStatus(ParameterStatusMessage { + identifier, + length, + param, + }), + )) } pub fn parse_ssl_response(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, tag) = alt((char('N'), char('S')))(i)?; - Ok((i, PgsqlBEMessage::SSLResponse( - SSLResponseMessage::from(tag)) - )) + Ok(( + i, + PgsqlBEMessage::SSLResponse(SSLResponseMessage::from(tag)), + )) } fn parse_backend_key_data_message(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { @@ -781,34 +826,43 @@ fn parse_backend_key_data_message(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, length) = verify(be_u32, |&x| x == 12)(i)?; let (i, pid) = be_u32(i)?; let (i, secret_key) = be_u32(i)?; - Ok((i, PgsqlBEMessage::BackendKeyData(BackendKeyDataMessage { - identifier, - length, - backend_pid: pid, - secret_key, - }))) + Ok(( + i, + PgsqlBEMessage::BackendKeyData(BackendKeyDataMessage { + identifier, + length, + backend_pid: pid, + secret_key, + }), + )) } fn parse_command_complete(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'C')(i)?; let (i, length) = verify(be_u32, |&x| x > PGSQL_LENGTH_FIELD)(i)?; let (i, payload) = map_parser(take(length - PGSQL_LENGTH_FIELD), take_until("\x00"))(i)?; - Ok((i, PgsqlBEMessage::CommandComplete(RegularPacket { - identifier, - length, - payload: payload.to_vec(), - }))) + Ok(( + i, + PgsqlBEMessage::CommandComplete(RegularPacket { + identifier, + length, + payload: payload.to_vec(), + }), + )) } fn parse_ready_for_query(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'Z')(i)?; let (i, length) = verify(be_u32, |&x| x == 5)(i)?; let (i, status) = verify(be_u8, |&x| x == b'I' || x == b'T' || x == b'E')(i)?; - Ok((i, PgsqlBEMessage::ReadyForQuery(ReadyForQueryMessage { - identifier, - length, - transaction_status: status, - }))) + Ok(( + i, + PgsqlBEMessage::ReadyForQuery(ReadyForQueryMessage { + identifier, + length, + transaction_status: status, + }), + )) } fn parse_row_field(i: &[u8]) -> IResult<&[u8], RowField> { @@ -820,15 +874,18 @@ fn parse_row_field(i: &[u8]) -> IResult<&[u8], RowField> { let (i, data_type_size) = be_i16(i)?; let (i, type_modifier) = be_i32(i)?; let (i, format_code) = be_u16(i)?; - Ok((i, RowField { - field_name: field_name.to_vec(), - table_oid, - column_index, - data_type_oid, - data_type_size, - type_modifier, - format_code, - })) + Ok(( + i, + RowField { + field_name: field_name.to_vec(), + table_oid, + column_index, + data_type_oid, + data_type_size, + type_modifier, + format_code, + }, + )) } pub fn parse_row_description(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { @@ -837,29 +894,34 @@ pub fn parse_row_description(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, field_count) = be_u16(i)?; let (i, fields) = map_parser( take(length - 6), - many_m_n(0, field_count.into(), parse_row_field) + many_m_n(0, field_count.into(), parse_row_field), )(i)?; - Ok((i, PgsqlBEMessage::RowDescription( - RowDescriptionMessage { - identifier, - length, - field_count, - fields, - }))) + Ok(( + i, + PgsqlBEMessage::RowDescription(RowDescriptionMessage { + identifier, + length, + field_count, + fields, + }), + )) } fn parse_data_row_value(i: &[u8]) -> IResult<&[u8], ColumnFieldValue> { let (i, value_length) = be_i32(i)?; let (i, value) = cond(value_length >= 0, take(value_length as usize))(i)?; - Ok((i, ColumnFieldValue { - value_length, - value: { - match value { - Some(data) => data.to_vec(), - None => [].to_vec(), - } + Ok(( + i, + ColumnFieldValue { + value_length, + value: { + match value { + Some(data) => data.to_vec(), + None => [].to_vec(), + } + }, }, - })) + )) } /// For each column, add up the data size. Return the total @@ -882,15 +944,19 @@ pub fn parse_consolidated_data_row(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, length) = verify(be_u32, |&x| x >= 6)(i)?; let (i, field_count) = be_u16(i)?; // 6 here is for skipping length + field_count - let (i, rows) = map_parser(take(length - 6), many_m_n(0, field_count.into(), parse_data_row_value))(i)?; - Ok((i, PgsqlBEMessage::ConsolidatedDataRow( - ConsolidatedDataRowPacket { - identifier, - length, - row_cnt: 1, - data_size: add_up_data_size(rows), - } - ))) + let (i, rows) = map_parser( + take(length - 6), + many_m_n(0, field_count.into(), parse_data_row_value), + )(i)?; + Ok(( + i, + PgsqlBEMessage::ConsolidatedDataRow(ConsolidatedDataRowPacket { + identifier, + length, + row_cnt: 1, + data_size: add_up_data_size(rows), + }), + )) } fn parse_sasl_mechanism(i: &[u8]) -> IResult<&[u8], SASLAuthenticationMechanism> { @@ -912,10 +978,13 @@ fn parse_sasl_mechanisms(i: &[u8]) -> IResult<&[u8], Vec IResult<&[u8], PgsqlErrorNoticeMessageField> { let (i, _field_type) = char('C')(i)?; let (i, field_value) = map_parser(take(6_usize), alphanumeric1)(i)?; - Ok((i, PgsqlErrorNoticeMessageField{ - field_type: PgsqlErrorNoticeFieldType::CodeSqlStateCode, - field_value: field_value.to_vec(), - })) + Ok(( + i, + PgsqlErrorNoticeMessageField { + field_type: PgsqlErrorNoticeFieldType::CodeSqlStateCode, + field_value: field_value.to_vec(), + }, + )) } // Parse an error response with non-localizeable severity message. @@ -924,10 +993,13 @@ pub fn parse_error_response_severity(i: &[u8]) -> IResult<&[u8], PgsqlErrorNotic let (i, field_type) = char('V')(i)?; let (i, field_value) = alt((tag("ERROR"), tag("FATAL"), tag("PANIC")))(i)?; let (i, _) = tag("\x00")(i)?; - Ok((i, PgsqlErrorNoticeMessageField{ - field_type: PgsqlErrorNoticeFieldType::from(field_type), - field_value: field_value.to_vec(), - })) + Ok(( + i, + PgsqlErrorNoticeMessageField { + field_type: PgsqlErrorNoticeFieldType::from(field_type), + field_value: field_value.to_vec(), + }, + )) } // The non-localizable version of Severity field has different values, @@ -935,16 +1007,20 @@ pub fn parse_error_response_severity(i: &[u8]) -> IResult<&[u8], PgsqlErrorNotic pub fn parse_notice_response_severity(i: &[u8]) -> IResult<&[u8], PgsqlErrorNoticeMessageField> { let (i, field_type) = char('V')(i)?; let (i, field_value) = alt(( - tag("WARNING"), - tag("NOTICE"), - tag("DEBUG"), - tag("INFO"), - tag("LOG")))(i)?; + tag("WARNING"), + tag("NOTICE"), + tag("DEBUG"), + tag("INFO"), + tag("LOG"), + ))(i)?; let (i, _) = tag("\x00")(i)?; - Ok((i, PgsqlErrorNoticeMessageField{ - field_type: PgsqlErrorNoticeFieldType::from(field_type), - field_value: field_value.to_vec(), - })) + Ok(( + i, + PgsqlErrorNoticeMessageField { + field_type: PgsqlErrorNoticeFieldType::from(field_type), + field_value: field_value.to_vec(), + }, + )) } pub fn parse_error_response_field( @@ -974,7 +1050,9 @@ pub fn parse_error_response_field( Ok((i, data)) } -pub fn parse_error_notice_fields(i: &[u8], is_err_msg: bool) -> IResult<&[u8], Vec> { +pub fn parse_error_notice_fields( + i: &[u8], is_err_msg: bool, +) -> IResult<&[u8], Vec> { let (i, data) = many_till(|b| parse_error_response_field(b, is_err_msg), tag("\x00"))(i)?; Ok((i, data.0)) } @@ -982,45 +1060,47 @@ pub fn parse_error_notice_fields(i: &[u8], is_err_msg: bool) -> IResult<&[u8], V fn pgsql_parse_error_response(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'E')(i)?; let (i, length) = verify(be_u32, |&x| x > 10)(i)?; - let (i, message_body) = map_parser( - take(length - PGSQL_LENGTH_FIELD), - |b| parse_error_notice_fields(b, true) - )(i)?; + let (i, message_body) = map_parser(take(length - PGSQL_LENGTH_FIELD), |b| { + parse_error_notice_fields(b, true) + })(i)?; - Ok((i, PgsqlBEMessage::ErrorResponse(ErrorNoticeMessage { - identifier, - length, - message_body, - }))) + Ok(( + i, + PgsqlBEMessage::ErrorResponse(ErrorNoticeMessage { + identifier, + length, + message_body, + }), + )) } fn pgsql_parse_notice_response(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'N')(i)?; let (i, length) = verify(be_u32, |&x| x > 10)(i)?; - let (i, message_body) = map_parser( - take(length - PGSQL_LENGTH_FIELD), - |b| parse_error_notice_fields(b, false) - )(i)?; - Ok((i, PgsqlBEMessage::NoticeResponse(ErrorNoticeMessage { - identifier, - length, - message_body, - }))) + let (i, message_body) = map_parser(take(length - PGSQL_LENGTH_FIELD), |b| { + parse_error_notice_fields(b, false) + })(i)?; + Ok(( + i, + PgsqlBEMessage::NoticeResponse(ErrorNoticeMessage { + identifier, + length, + message_body, + }), + )) } fn parse_notification_response(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, identifier) = verify(be_u8, |&x| x == b'A')(i)?; // length (u32) + pid (u32) + at least one byte, for we have two str fields let (i, length) = verify(be_u32, |&x| x > 9)(i)?; - let (i, data) = map_parser( - take(length - PGSQL_LENGTH_FIELD), - |b| { - let (b, pid) = be_u32(b)?; - let (b, channel_name) = take_until_and_consume(b"\x00")(b)?; - let (b, payload) = take_until_and_consume(b"\x00")(b)?; - Ok((b, (pid, channel_name, payload))) - })(i)?; - let msg = PgsqlBEMessage::NotificationResponse(NotificationResponse{ + let (i, data) = map_parser(take(length - PGSQL_LENGTH_FIELD), |b| { + let (b, pid) = be_u32(b)?; + let (b, channel_name) = take_until_and_consume(b"\x00")(b)?; + let (b, payload) = take_until_and_consume(b"\x00")(b)?; + Ok((b, (pid, channel_name, payload))) + })(i)?; + let msg = PgsqlBEMessage::NotificationResponse(NotificationResponse { identifier, length, pid: data.0, @@ -1032,30 +1112,28 @@ fn parse_notification_response(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { pub fn pgsql_parse_response(i: &[u8]) -> IResult<&[u8], PgsqlBEMessage> { let (i, pseudo_header) = peek(tuple((be_u8, be_u32)))(i)?; - let (i, message) = - match pseudo_header.0 { - b'E' => pgsql_parse_error_response(i)?, - b'K' => parse_backend_key_data_message(i)?, - b'N' => pgsql_parse_notice_response(i)?, - b'R' => pgsql_parse_authentication_message(i)?, - b'S' => parse_parameter_status_message(i)?, - b'C' => parse_command_complete(i)?, - b'Z' => parse_ready_for_query(i)?, - b'T' => parse_row_description(i)?, - b'A' => parse_notification_response(i)?, - b'D' => parse_consolidated_data_row(i)?, - // _ => return Err(Err::Error(make_error(i, ErrorKind::Switch))), - _ => { - let (i, payload) = rest(i)?; - let unknown = PgsqlBEMessage::UnknownMessageType (RegularPacket{ - identifier: pseudo_header.0, - length: pseudo_header.1, - payload: payload.to_vec(), - }); - (i, unknown) - } - - }; + let (i, message) = match pseudo_header.0 { + b'E' => pgsql_parse_error_response(i)?, + b'K' => parse_backend_key_data_message(i)?, + b'N' => pgsql_parse_notice_response(i)?, + b'R' => pgsql_parse_authentication_message(i)?, + b'S' => parse_parameter_status_message(i)?, + b'C' => parse_command_complete(i)?, + b'Z' => parse_ready_for_query(i)?, + b'T' => parse_row_description(i)?, + b'A' => parse_notification_response(i)?, + b'D' => parse_consolidated_data_row(i)?, + // _ => return Err(Err::Error(make_error(i, ErrorKind::Switch))), + _ => { + let (i, payload) = rest(i)?; + let unknown = PgsqlBEMessage::UnknownMessageType(RegularPacket { + identifier: pseudo_header.0, + length: pseudo_header.1, + payload: payload.to_vec(), + }); + (i, unknown) + } + }; Ok((i, message)) } @@ -1855,7 +1933,8 @@ mod tests { 0x2b, 0x4a, 0x36, 0x79, 0x78, 0x72, 0x66, 0x77, 0x2f, 0x7a, 0x7a, 0x70, 0x38, 0x59, 0x54, 0x39, 0x65, 0x78, 0x56, 0x37, 0x73, 0x38, 0x3d, ]; - let (remainder, result) = pgsql_parse_response(bad_buf).expect("parsing sasl final response failed"); + let (remainder, result) = + pgsql_parse_response(bad_buf).expect("parsing sasl final response failed"); let res = PgsqlBEMessage::UnknownMessageType(RegularPacket { identifier: b'`', length: 54, @@ -2067,55 +2146,34 @@ mod tests { // S #standard_conforming_strings on S ·TimeZone Europe/Paris // K ···O··Z ·I let buf = &[ - 0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x53, 0x00, 0x00, 0x00, 0x16, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, - 0x53, 0x00, 0x00, 0x00, 0x19, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x6e, 0x63, 0x6f, - 0x64, 0x69, 0x6e, 0x67, 0x00, 0x55, 0x54, 0x46, - 0x38, 0x00, 0x53, 0x00, 0x00, 0x00, 0x17, 0x44, - 0x61, 0x74, 0x65, 0x53, 0x74, 0x79, 0x6c, 0x65, - 0x00, 0x49, 0x53, 0x4f, 0x2c, 0x20, 0x4d, 0x44, - 0x59, 0x00, 0x53, 0x00, 0x00, 0x00, 0x26, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, - 0x6f, 0x6e, 0x6c, 0x79, 0x00, 0x6f, 0x66, 0x66, - 0x00, 0x53, 0x00, 0x00, 0x00, 0x17, 0x69, 0x6e, - 0x5f, 0x68, 0x6f, 0x74, 0x5f, 0x73, 0x74, 0x61, - 0x6e, 0x64, 0x62, 0x79, 0x00, 0x6f, 0x66, 0x66, - 0x00, 0x53, 0x00, 0x00, 0x00, 0x19, 0x69, 0x6e, - 0x74, 0x65, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x61, - 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x00, - 0x6f, 0x6e, 0x00, 0x53, 0x00, 0x00, 0x00, 0x1b, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, - 0x53, 0x74, 0x79, 0x6c, 0x65, 0x00, 0x70, 0x6f, - 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x00, 0x53, - 0x00, 0x00, 0x00, 0x15, 0x69, 0x73, 0x5f, 0x73, - 0x75, 0x70, 0x65, 0x72, 0x75, 0x73, 0x65, 0x72, - 0x00, 0x6f, 0x66, 0x66, 0x00, 0x53, 0x00, 0x00, - 0x00, 0x19, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, - 0x67, 0x00, 0x55, 0x54, 0x46, 0x38, 0x00, 0x53, - 0x00, 0x00, 0x00, 0x18, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x00, 0x31, 0x34, 0x2e, 0x35, 0x00, - 0x53, 0x00, 0x00, 0x00, 0x22, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x00, 0x63, 0x74, 0x66, 0x70, 0x6f, - 0x73, 0x74, 0x00, 0x53, 0x00, 0x00, 0x00, 0x23, - 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, - 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x73, 0x00, 0x6f, 0x6e, 0x00, 0x53, - 0x00, 0x00, 0x00, 0x1a, 0x54, 0x69, 0x6d, 0x65, - 0x5a, 0x6f, 0x6e, 0x65, 0x00, 0x45, 0x75, 0x72, - 0x6f, 0x70, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x69, - 0x73, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x0c, 0x00, - 0x00, 0x0b, 0x8d, 0xcf, 0x4f, 0xb6, 0xcf, 0x5a, - 0x00, 0x00, 0x00, 0x05, 0x49 + 0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x16, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x19, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, 0x55, 0x54, 0x46, + 0x38, 0x00, 0x53, 0x00, 0x00, 0x00, 0x17, 0x44, 0x61, 0x74, 0x65, 0x53, 0x74, 0x79, + 0x6c, 0x65, 0x00, 0x49, 0x53, 0x4f, 0x2c, 0x20, 0x4d, 0x44, 0x59, 0x00, 0x53, 0x00, + 0x00, 0x00, 0x26, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, + 0x6f, 0x6e, 0x6c, 0x79, 0x00, 0x6f, 0x66, 0x66, 0x00, 0x53, 0x00, 0x00, 0x00, 0x17, + 0x69, 0x6e, 0x5f, 0x68, 0x6f, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x62, 0x79, + 0x00, 0x6f, 0x66, 0x66, 0x00, 0x53, 0x00, 0x00, 0x00, 0x19, 0x69, 0x6e, 0x74, 0x65, + 0x67, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x00, + 0x6f, 0x6e, 0x00, 0x53, 0x00, 0x00, 0x00, 0x1b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x00, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, + 0x65, 0x73, 0x00, 0x53, 0x00, 0x00, 0x00, 0x15, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x70, + 0x65, 0x72, 0x75, 0x73, 0x65, 0x72, 0x00, 0x6f, 0x66, 0x66, 0x00, 0x53, 0x00, 0x00, + 0x00, 0x19, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x00, 0x55, 0x54, 0x46, 0x38, 0x00, 0x53, 0x00, 0x00, 0x00, 0x18, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x00, 0x31, 0x34, 0x2e, 0x35, 0x00, 0x53, 0x00, 0x00, 0x00, 0x22, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x63, 0x74, 0x66, 0x70, 0x6f, 0x73, 0x74, 0x00, 0x53, + 0x00, 0x00, 0x00, 0x23, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x63, + 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x73, 0x00, 0x6f, 0x6e, 0x00, 0x53, 0x00, 0x00, 0x00, 0x1a, 0x54, 0x69, + 0x6d, 0x65, 0x5a, 0x6f, 0x6e, 0x65, 0x00, 0x45, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x2f, + 0x50, 0x61, 0x72, 0x69, 0x73, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0b, + 0x8d, 0xcf, 0x4f, 0xb6, 0xcf, 0x5a, 0x00, 0x00, 0x00, 0x05, 0x49, ]; let result = pgsql_parse_response(buf); diff --git a/rust/src/pgsql/pgsql.rs b/rust/src/pgsql/pgsql.rs index f5fbebc8f950..1ee595371015 100644 --- a/rust/src/pgsql/pgsql.rs +++ b/rust/src/pgsql/pgsql.rs @@ -151,7 +151,7 @@ impl Default for PgsqlState { Self::new() } } - + impl PgsqlState { pub fn new() -> Self { Self { @@ -552,11 +552,10 @@ fn probe_tc(input: &[u8]) -> bool { /// C entry point for a probing parser. #[no_mangle] -pub unsafe extern "C" fn rs_pgsql_probing_parser_ts( +pub unsafe extern fn rs_pgsql_probing_parser_ts( _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { if input_len >= 1 && !input.is_null() { - let slice: &[u8] = build_slice!(input, input_len as usize); if probe_ts(slice) { return ALPROTO_PGSQL; @@ -567,11 +566,10 @@ pub unsafe extern "C" fn rs_pgsql_probing_parser_ts( /// C entry point for a probing parser. #[no_mangle] -pub unsafe extern "C" fn rs_pgsql_probing_parser_tc( +pub unsafe extern fn rs_pgsql_probing_parser_tc( _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { if input_len >= 1 && !input.is_null() { - let slice: &[u8] = build_slice!(input, input_len as usize); if parser::parse_ssl_response(slice).is_ok() { @@ -594,7 +592,7 @@ pub unsafe extern "C" fn rs_pgsql_probing_parser_tc( } #[no_mangle] -pub extern "C" fn rs_pgsql_state_new( +pub extern fn rs_pgsql_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = PgsqlState::new(); @@ -603,13 +601,13 @@ pub extern "C" fn rs_pgsql_state_new( } #[no_mangle] -pub extern "C" fn rs_pgsql_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_pgsql_state_free(state: *mut std::os::raw::c_void) { // Just unbox... std::mem::drop(unsafe { Box::from_raw(state as *mut PgsqlState) }); } #[no_mangle] -pub extern "C" fn rs_pgsql_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub extern fn rs_pgsql_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state_safe: &mut PgsqlState; unsafe { state_safe = cast_pointer!(state, PgsqlState); @@ -618,7 +616,7 @@ pub extern "C" fn rs_pgsql_state_tx_free(state: *mut std::os::raw::c_void, tx_id } #[no_mangle] -pub unsafe extern "C" fn rs_pgsql_parse_request( +pub unsafe extern fn rs_pgsql_parse_request( _flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -631,7 +629,6 @@ pub unsafe extern "C" fn rs_pgsql_parse_request( } } - let state_safe: &mut PgsqlState = cast_pointer!(state, PgsqlState); if stream_slice.is_gap() { @@ -643,7 +640,7 @@ pub unsafe extern "C" fn rs_pgsql_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_pgsql_parse_response( +pub unsafe extern fn rs_pgsql_parse_response( flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -660,7 +657,7 @@ pub unsafe extern "C" fn rs_pgsql_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_pgsql_state_get_tx( +pub unsafe extern fn rs_pgsql_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state_safe: &mut PgsqlState = cast_pointer!(state, PgsqlState); @@ -675,7 +672,7 @@ pub unsafe extern "C" fn rs_pgsql_state_get_tx( } #[no_mangle] -pub extern "C" fn rs_pgsql_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub extern fn rs_pgsql_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state_safe: &mut PgsqlState; unsafe { state_safe = cast_pointer!(state, PgsqlState); @@ -684,7 +681,7 @@ pub extern "C" fn rs_pgsql_state_get_tx_count(state: *mut std::os::raw::c_void) } #[no_mangle] -pub extern "C" fn rs_pgsql_tx_get_state(tx: *mut std::os::raw::c_void) -> PgsqlTransactionState { +pub extern fn rs_pgsql_tx_get_state(tx: *mut std::os::raw::c_void) -> PgsqlTransactionState { let tx_safe: &mut PgsqlTransaction; unsafe { tx_safe = cast_pointer!(tx, PgsqlTransaction); @@ -693,7 +690,7 @@ pub extern "C" fn rs_pgsql_tx_get_state(tx: *mut std::os::raw::c_void) -> PgsqlT } #[no_mangle] -pub extern "C" fn rs_pgsql_tx_get_alstate_progress( +pub extern fn rs_pgsql_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { return rs_pgsql_tx_get_state(tx) as i32; @@ -706,7 +703,7 @@ export_state_data_get!(rs_pgsql_get_state_data, PgsqlState); const PARSER_NAME: &[u8] = b"pgsql\0"; #[no_mangle] -pub unsafe extern "C" fn rs_pgsql_register_parser() { +pub unsafe extern fn rs_pgsql_register_parser() { let default_port = CString::new("[5432]").unwrap(); let mut stream_depth = PGSQL_CONFIG_DEFAULT_STREAM_DEPTH; let parser = RustParser { diff --git a/rust/src/quic/detect.rs b/rust/src/quic/detect.rs index 7e9019bef004..bb14900f9bda 100644 --- a/rust/src/quic/detect.rs +++ b/rust/src/quic/detect.rs @@ -19,7 +19,7 @@ use crate::quic::quic::QuicTransaction; use std::ptr; #[no_mangle] -pub unsafe extern "C" fn rs_quic_tx_get_ua( +pub unsafe extern fn rs_quic_tx_get_ua( tx: &QuicTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ua) = &tx.ua { @@ -34,7 +34,7 @@ pub unsafe extern "C" fn rs_quic_tx_get_ua( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_tx_get_sni( +pub unsafe extern fn rs_quic_tx_get_sni( tx: &QuicTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(sni) = &tx.sni { @@ -49,7 +49,7 @@ pub unsafe extern "C" fn rs_quic_tx_get_sni( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_tx_get_ja3( +pub unsafe extern fn rs_quic_tx_get_ja3( tx: &QuicTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ja3) = &tx.ja3 { @@ -64,7 +64,7 @@ pub unsafe extern "C" fn rs_quic_tx_get_ja3( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_tx_get_version( +pub unsafe extern fn rs_quic_tx_get_version( tx: &QuicTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if tx.header.flags.is_long { @@ -80,7 +80,7 @@ pub unsafe extern "C" fn rs_quic_tx_get_version( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_tx_get_cyu_hash( +pub unsafe extern fn rs_quic_tx_get_cyu_hash( tx: &QuicTransaction, i: u32, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if (i as usize) < tx.cyu.len() { @@ -101,7 +101,7 @@ pub unsafe extern "C" fn rs_quic_tx_get_cyu_hash( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_tx_get_cyu_string( +pub unsafe extern fn rs_quic_tx_get_cyu_string( tx: &QuicTransaction, i: u32, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if (i as usize) < tx.cyu.len() { diff --git a/rust/src/quic/frames.rs b/rust/src/quic/frames.rs index e1fb7d080727..97de729bfa2a 100644 --- a/rust/src/quic/frames.rs +++ b/rust/src/quic/frames.rs @@ -504,8 +504,7 @@ impl Frame { let mut d = vec![0; crypto_max_size as usize]; for f in &frames { if let Frame::CryptoFrag(c) = f { - d[c.offset as usize..(c.offset + c.length) as usize] - .clone_from_slice(&c.data); + d[c.offset as usize..(c.offset + c.length) as usize].clone_from_slice(&c.data); } } if let Ok((_, msg)) = parse_tls_message_handshake(&d) { diff --git a/rust/src/quic/logger.rs b/rust/src/quic/logger.rs index 8cb08830e4d0..4370539c765f 100644 --- a/rust/src/quic/logger.rs +++ b/rust/src/quic/logger.rs @@ -149,9 +149,7 @@ fn log_quic(tx: &QuicTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> } #[no_mangle] -pub unsafe extern "C" fn rs_quic_to_json( - tx: *mut std::os::raw::c_void, js: &mut JsonBuilder, -) -> bool { +pub unsafe extern fn rs_quic_to_json(tx: *mut std::os::raw::c_void, js: &mut JsonBuilder) -> bool { let tx = cast_pointer!(tx, QuicTransaction); log_quic(tx, js).is_ok() } diff --git a/rust/src/quic/quic.rs b/rust/src/quic/quic.rs index 8e3ea6f35a21..0303a62163a0 100644 --- a/rust/src/quic/quic.rs +++ b/rust/src/quic/quic.rs @@ -22,7 +22,7 @@ use super::{ parser::{quic_pkt_num, QuicData, QuicHeader, QuicType}, }; use crate::applayer::{self, *}; -use crate::core::{AppProto, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_UDP, Direction}; +use crate::core::{AppProto, Direction, Flow, ALPROTO_FAILED, ALPROTO_UNKNOWN, IPPROTO_UDP}; use std::collections::VecDeque; use std::ffi::CString; use tls_parser::TlsExtensionType; @@ -57,7 +57,11 @@ impl QuicTransaction { header: QuicHeader, data: QuicData, sni: Option>, ua: Option>, extv: Vec, ja3: Option, client: bool, ) -> Self { - let direction = if client { Direction::ToServer } else { Direction::ToClient }; + let direction = if client { + Direction::ToServer + } else { + Direction::ToClient + }; let cyu = Cyu::generate(&header, &data.frames); QuicTransaction { tx_id: 0, @@ -73,7 +77,11 @@ impl QuicTransaction { } fn new_empty(client: bool, header: QuicHeader) -> Self { - let direction = if client { Direction::ToServer } else { Direction::ToClient }; + let direction = if client { + Direction::ToServer + } else { + Direction::ToClient + }; QuicTransaction { tx_id: 0, header, @@ -329,7 +337,7 @@ impl QuicState { } #[no_mangle] -pub extern "C" fn rs_quic_state_new( +pub extern fn rs_quic_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = QuicState::new(); @@ -338,19 +346,19 @@ pub extern "C" fn rs_quic_state_new( } #[no_mangle] -pub extern "C" fn rs_quic_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_quic_state_free(state: *mut std::os::raw::c_void) { // Just unbox... std::mem::drop(unsafe { Box::from_raw(state as *mut QuicState) }); } #[no_mangle] -pub unsafe extern "C" fn rs_quic_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_quic_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, QuicState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_quic_probing_parser( +pub unsafe extern fn rs_quic_probing_parser( _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { let slice = build_slice!(input, input_len as usize); @@ -363,7 +371,7 @@ pub unsafe extern "C" fn rs_quic_probing_parser( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_parse_tc( +pub unsafe extern fn rs_quic_parse_tc( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -378,7 +386,7 @@ pub unsafe extern "C" fn rs_quic_parse_tc( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_parse_ts( +pub unsafe extern fn rs_quic_parse_ts( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -393,7 +401,7 @@ pub unsafe extern "C" fn rs_quic_parse_ts( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_state_get_tx( +pub unsafe extern fn rs_quic_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, QuicState); @@ -408,19 +416,19 @@ pub unsafe extern "C" fn rs_quic_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_quic_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, QuicState); return state.max_tx_id; } #[no_mangle] -pub extern "C" fn rs_quic_state_progress_completion_status(_direction: u8) -> std::os::raw::c_int { +pub extern fn rs_quic_state_progress_completion_status(_direction: u8) -> std::os::raw::c_int { // This parser uses 1 to signal transaction completion status. return 1; } #[no_mangle] -pub unsafe extern "C" fn rs_quic_tx_get_alstate_progress( +pub unsafe extern fn rs_quic_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { let _tx = cast_pointer!(tx, QuicTransaction); @@ -428,7 +436,7 @@ pub unsafe extern "C" fn rs_quic_tx_get_alstate_progress( } #[no_mangle] -pub unsafe extern "C" fn rs_quic_state_get_tx_iterator( +pub unsafe extern fn rs_quic_state_get_tx_iterator( _ipproto: u8, _alproto: AppProto, state: *mut std::os::raw::c_void, min_tx_id: u64, _max_tx_id: u64, istate: &mut u64, ) -> applayer::AppLayerGetTxIterTuple { @@ -452,7 +460,7 @@ export_state_data_get!(rs_quic_get_state_data, QuicState); const PARSER_NAME: &[u8] = b"quic\0"; #[no_mangle] -pub unsafe extern "C" fn rs_quic_register_parser() { +pub unsafe extern fn rs_quic_register_parser() { let default_port = CString::new("[443,80]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, diff --git a/rust/src/rdp/log.rs b/rust/src/rdp/log.rs index e0a71a839b8f..68dd78c6f9db 100644 --- a/rust/src/rdp/log.rs +++ b/rust/src/rdp/log.rs @@ -21,10 +21,10 @@ use super::rdp::{RdpTransaction, RdpTransactionItem}; use crate::jsonbuilder::{JsonBuilder, JsonError}; use crate::rdp::parser::*; use crate::rdp::windows; -use x509_parser::prelude::{X509Certificate, FromDer}; +use x509_parser::prelude::{FromDer, X509Certificate}; #[no_mangle] -pub extern "C" fn rs_rdp_to_json(tx: &mut RdpTransaction, js: &mut JsonBuilder) -> bool { +pub extern fn rs_rdp_to_json(tx: &mut RdpTransaction, js: &mut JsonBuilder) -> bool { log(tx, js).is_ok() } diff --git a/rust/src/rdp/parser.rs b/rust/src/rdp/parser.rs index a8004e290b96..fe4da5b5d9e7 100644 --- a/rust/src/rdp/parser.rs +++ b/rust/src/rdp/parser.rs @@ -480,12 +480,10 @@ fn take_4_4_bits(input: &[u8]) -> IResult<&[u8], (u8, u8), RdpError> { } fn parse_class_options(i: &[u8]) -> IResult<&[u8], (u8, u8)> { - bits( - tuple(( - verify(take_bits(4u8), |&x| x <= 4), - verify(take_bits(4u8), |&x| x <= 3) - )) - )(i) + bits(tuple(( + verify(take_bits(4u8), |&x| x <= 4), + verify(take_bits(4u8), |&x| x <= 3), + )))(i) } /// rdp-spec, section 2.2.1.1 @@ -576,14 +574,19 @@ fn parse_rdp_cookie(i: &[u8]) -> IResult<&[u8], RdpCookie, RdpError> { let (i, _name) = tag(b"mstshash=")(i)?; let (i, bytes) = take_until_and_consume(b"\r\n")(i)?; // let (i, s) = map_res(value!(bytes), std::str::from_utf8)(i)?; - let s = std::str::from_utf8(bytes).map_err(|_| Err::Error(make_error(bytes, ErrorKind::MapRes)))?; - let cookie = RdpCookie{ mstshash: String::from(s) }; + let s = + std::str::from_utf8(bytes).map_err(|_| Err::Error(make_error(bytes, ErrorKind::MapRes)))?; + let cookie = RdpCookie { + mstshash: String::from(s), + }; Ok((i, cookie)) } // rdp-spec, section 2.2.1.1.1 fn parse_negotiation_request(i: &[u8]) -> IResult<&[u8], NegotiationRequest, RdpError> { - let (i, _typ) = verify(le_u8, |&x| x == X224ConnectionRequestType::NegotiationRequest as u8)(i)?; + let (i, _typ) = verify(le_u8, |&x| { + x == X224ConnectionRequestType::NegotiationRequest as u8 + })(i)?; let (i, flags) = map_opt(le_u8, NegotiationRequestFlags::from_bits)(i)?; // u8, u8, u16, and u32 give _length of 8 let (i, _length) = verify(le_u16, |&x| x == 8)(i)?; @@ -665,7 +668,9 @@ fn parse_x224_connection_confirm_class_0( // rdp-spec, section 2.2.1.1.1 fn parse_negotiation_response(i: &[u8]) -> IResult<&[u8], NegotiationResponse, RdpError> { - let (i, _typ) = verify(le_u8, |&x| x == X224ConnectionRequestType::NegotiationResponse as u8)(i)?; + let (i, _typ) = verify(le_u8, |&x| { + x == X224ConnectionRequestType::NegotiationResponse as u8 + })(i)?; let (i, flags) = map_opt(le_u8, NegotiationResponseFlags::from_bits)(i)?; // u8, u8, u16, and u32 give _length of 8 let (i, _length) = verify(le_u16, |&x| x == 8)(i)?; @@ -675,7 +680,9 @@ fn parse_negotiation_response(i: &[u8]) -> IResult<&[u8], NegotiationResponse, R // rdp-spec, section 2.2.1.1.1 fn parse_negotiation_failure(i: &[u8]) -> IResult<&[u8], NegotiationFailure, RdpError> { - let (i, _typ) = verify(le_u8, |&x| x == X224ConnectionRequestType::NegotiationFailure as u8)(i)?; + let (i, _typ) = verify(le_u8, |&x| { + x == X224ConnectionRequestType::NegotiationFailure as u8 + })(i)?; let (i, _flags) = le_u8(i)?; // u8, u8, u16, and u32 give _length of 8 let (i, _length) = verify(le_u16, |&x| x == 8)(i)?; @@ -686,13 +693,11 @@ fn parse_negotiation_failure(i: &[u8]) -> IResult<&[u8], NegotiationFailure, Rdp /// x224-spec, section 13.7 fn parse_x223_data_class_0(input: &[u8]) -> IResult<&[u8], X223Data, RdpError> { fn parser(i: &[u8]) -> IResult<&[u8], (u8, u8, u8)> { - bits( - tuple(( - verify(take_bits(4u8), |&x| x == 0xf), - verify(take_bits(3u8), |&x| x == 0), - verify(take_bits(1u8), |&x| x == 0) - )) - )(i) + bits(tuple(( + verify(take_bits(4u8), |&x| x == 0xf), + verify(take_bits(3u8), |&x| x == 0), + verify(take_bits(1u8), |&x| x == 0), + )))(i) } let (i1, _length) = verify(be_u8, |&x| x == 2)(input)?; let (i2, _dt_x_roa) = parser(i1).map_err(Err::convert)?; @@ -728,10 +733,9 @@ fn parse_mcs_connect(input: &[u8]) -> IResult<&[u8], McsConnectRequest, RdpError let (i1, _ber_type) = verify( le_u8, // BER: 0b01=application, 0b1=non-primitive, 0b11111 - |&x| x == 0x7f + |&x| x == 0x7f, )(input)?; - let (i2, _t125_type) = verify(le_u8, |&x| x - == T125Type::T125TypeMcsConnectRequest as u8)(i1)?; + let (i2, _t125_type) = verify(le_u8, |&x| x == T125Type::T125TypeMcsConnectRequest as u8)(i1)?; // skip to, and consume, H.221 client-to-server key let (i3, _skipped) = take_until_and_consume(b"Duca")(i2)?; @@ -769,9 +773,7 @@ fn parse_mcs_connect(input: &[u8]) -> IResult<&[u8], McsConnectRequest, RdpError break; } }, - Err(Err::Incomplete(i)) => { - return Err(Err::Incomplete(i)) - } + Err(Err::Incomplete(i)) => return Err(Err::Incomplete(i)), Err(Err::Failure(_)) | Err(Err::Error(_)) => break, } } @@ -859,8 +861,7 @@ fn parse_cs_client_core_data(input: &[u8]) -> IResult<&[u8], CsClientCoreData> { let (j18, early_capability_flags) = match supported_color_depth { None => (j17, None), Some(_) => { - match opt(map_opt(le_u16, EarlyCapabilityFlags::from_bits))(j17) as IResult<&[u8], _> - { + match opt(map_opt(le_u16, EarlyCapabilityFlags::from_bits))(j17) as IResult<&[u8], _> { Ok((rem, obj)) => (rem, obj), _ => (j17, None), } @@ -897,12 +898,10 @@ fn parse_cs_client_core_data(input: &[u8]) -> IResult<&[u8], CsClientCoreData> { let (j22, server_selected_protocol) = match pad { None => (j21, None), - Some(_) => { - match opt(map_opt(le_u32, ProtocolFlags::from_bits))(j21) as IResult<&[u8], _> { - Ok((rem, obj)) => (rem, obj), - _ => (j21, None), - } - } + Some(_) => match opt(map_opt(le_u32, ProtocolFlags::from_bits))(j21) as IResult<&[u8], _> { + Ok((rem, obj)) => (rem, obj), + _ => (j21, None), + }, }; let (j23, desktop_physical_width) = match server_selected_protocol { @@ -1017,7 +1016,13 @@ fn parse_cs_unknown(i: &[u8]) -> IResult<&[u8], CsUnknown> { // less u16, u16 let (i, sz) = map_opt(le_u16, |x: u16| x.checked_sub(4))(i)?; let (i, data) = take(sz)(i)?; - Ok((i, CsUnknown { typ, data: data.to_vec() })) + Ok(( + i, + CsUnknown { + typ, + data: data.to_vec(), + }, + )) } // rdp-spec, section 2.2.1.4 @@ -1025,7 +1030,8 @@ fn parse_mcs_connect_response(i: &[u8]) -> IResult<&[u8], McsConnectResponse, Rd let (i, _ber_type) = verify( le_u8, // BER: 0b01=application, 0b1=non-primitive, 0b11111 - |&x| x == 0x7f)(i)?; + |&x| x == 0x7f, + )(i)?; let (i, _t125_type) = verify(le_u8, |&x| x == T125Type::T125TypeMcsConnectResponse as u8)(i)?; Ok((i, McsConnectResponse {})) } @@ -1090,7 +1096,9 @@ mod tests_negotiate_49350 { cookie: None, negotiation_request: Some(NegotiationRequest { flags: NegotiationRequestFlags::empty(), - protocols: ProtocolFlags { bits: Protocol::ProtocolRdp as u32 }, + protocols: ProtocolFlags { + bits: Protocol::ProtocolRdp as u32, + }, }), data: Vec::new(), }), @@ -1180,7 +1188,9 @@ mod tests_core_49350 { ), client_dig_product_id: Some(String::from("")), connection_hint: Some(ConnectionHint::ConnectionHintNotProvided), - server_selected_protocol: Some(ProtocolFlags { bits: Protocol::ProtocolRdp as u32 }), + server_selected_protocol: Some(ProtocolFlags { + bits: Protocol::ProtocolRdp as u32, + }), desktop_physical_width: None, desktop_physical_height: None, desktop_orientation: None, @@ -1351,7 +1361,7 @@ mod tests_negotiate_incomplete_49350 { assert_eq!( // fails: expr_opt!(i5, length.checked_sub(6))? // not counting a u8 length read, which was also successful - Err(Err::Incomplete(Needed::new( 1))), + Err(Err::Incomplete(Needed::new(1))), parse_x224_connection_request_class_0(x224_bytes) ) } diff --git a/rust/src/rdp/rdp.rs b/rust/src/rdp/rdp.rs index f08026a82db8..ffb79ac4d814 100644 --- a/rust/src/rdp/rdp.rs +++ b/rust/src/rdp/rdp.rs @@ -72,7 +72,7 @@ impl RdpTransaction { } #[no_mangle] -pub unsafe extern "C" fn rs_rdp_state_get_tx( +pub unsafe extern fn rs_rdp_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, RdpState); @@ -87,13 +87,13 @@ pub unsafe extern "C" fn rs_rdp_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_rdp_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_rdp_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, RdpState); return state.next_id; } #[no_mangle] -pub extern "C" fn rs_rdp_tx_get_progress( +pub extern fn rs_rdp_tx_get_progress( _tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { // tx complete when `rs_rdp_tx_get_progress(...) == rs_rdp_tx_get_progress_complete(...)` @@ -375,19 +375,21 @@ impl RdpState { } #[no_mangle] -pub extern "C" fn rs_rdp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_rdp_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = RdpState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub extern "C" fn rs_rdp_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_rdp_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(unsafe { Box::from_raw(state as *mut RdpState) }); } #[no_mangle] -pub unsafe extern "C" fn rs_rdp_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_rdp_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, RdpState); state.free_tx(tx_id); } @@ -403,7 +405,7 @@ fn probe_rdp(input: &[u8]) -> bool { /// probe for T.123 message, whether to client or to server #[no_mangle] -pub unsafe extern "C" fn rs_rdp_probe_ts_tc( +pub unsafe extern fn rs_rdp_probe_ts_tc( _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { if !input.is_null() { @@ -430,10 +432,9 @@ fn probe_tls_handshake(input: &[u8]) -> bool { // #[no_mangle] -pub unsafe extern "C" fn rs_rdp_parse_ts( +pub unsafe extern fn rs_rdp_parse_ts( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, RdpState); let buf = stream_slice.as_slice(); @@ -442,10 +443,9 @@ pub unsafe extern "C" fn rs_rdp_parse_ts( } #[no_mangle] -pub unsafe extern "C" fn rs_rdp_parse_tc( +pub unsafe extern fn rs_rdp_parse_tc( _flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, RdpState); let buf = stream_slice.as_slice(); @@ -463,7 +463,7 @@ export_state_data_get!(rs_rdp_get_state_data, RdpState); const PARSER_NAME: &[u8] = b"rdp\0"; #[no_mangle] -pub unsafe extern "C" fn rs_rdp_register_parser() { +pub unsafe extern fn rs_rdp_register_parser() { let default_port = std::ffi::CString::new("[3389]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, diff --git a/rust/src/rfb/detect.rs b/rust/src/rfb/detect.rs index 1cf0887c4fda..23ba912f6bba 100644 --- a/rust/src/rfb/detect.rs +++ b/rust/src/rfb/detect.rs @@ -21,7 +21,7 @@ use crate::rfb::rfb::*; use std::ptr; #[no_mangle] -pub unsafe extern "C" fn rs_rfb_tx_get_name( +pub unsafe extern fn rs_rfb_tx_get_name( tx: &mut RFBTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref r) = tx.tc_server_init { @@ -40,7 +40,7 @@ pub unsafe extern "C" fn rs_rfb_tx_get_name( } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_tx_get_sectype(tx: &mut RFBTransaction, sectype: *mut u32) -> u8 { +pub unsafe extern fn rs_rfb_tx_get_sectype(tx: &mut RFBTransaction, sectype: *mut u32) -> u8 { if let Some(ref r) = tx.chosen_security_type { *sectype = *r; return 1; @@ -52,9 +52,7 @@ pub unsafe extern "C" fn rs_rfb_tx_get_sectype(tx: &mut RFBTransaction, sectype: } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_tx_get_secresult( - tx: &mut RFBTransaction, secresult: *mut u32, -) -> u8 { +pub unsafe extern fn rs_rfb_tx_get_secresult(tx: &mut RFBTransaction, secresult: *mut u32) -> u8 { if let Some(ref r) = tx.tc_security_result { *secresult = r.status; return 1; diff --git a/rust/src/rfb/logger.rs b/rust/src/rfb/logger.rs index 62bb20966fe7..02fa61c52d31 100644 --- a/rust/src/rfb/logger.rs +++ b/rust/src/rfb/logger.rs @@ -127,7 +127,7 @@ fn log_rfb(tx: &RFBTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_logger_log( +pub unsafe extern fn rs_rfb_logger_log( tx: *mut std::os::raw::c_void, js: &mut JsonBuilder, ) -> bool { let tx = cast_pointer!(tx, RFBTransaction); diff --git a/rust/src/rfb/rfb.rs b/rust/src/rfb/rfb.rs index 8c3381345012..f81096e901b5 100644 --- a/rust/src/rfb/rfb.rs +++ b/rust/src/rfb/rfb.rs @@ -744,7 +744,7 @@ impl RFBState { // C exports. #[no_mangle] -pub extern "C" fn rs_rfb_state_new( +pub extern fn rs_rfb_state_new( _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, ) -> *mut std::os::raw::c_void { let state = RFBState::new(); @@ -753,19 +753,19 @@ pub extern "C" fn rs_rfb_state_new( } #[no_mangle] -pub extern "C" fn rs_rfb_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_rfb_state_free(state: *mut std::os::raw::c_void) { // Just unbox... std::mem::drop(unsafe { Box::from_raw(state as *mut RFBState) }); } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_rfb_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, RFBState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_parse_request( +pub unsafe extern fn rs_rfb_parse_request( flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -774,7 +774,7 @@ pub unsafe extern "C" fn rs_rfb_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_parse_response( +pub unsafe extern fn rs_rfb_parse_response( flow: *const Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { @@ -783,7 +783,7 @@ pub unsafe extern "C" fn rs_rfb_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_state_get_tx( +pub unsafe extern fn rs_rfb_state_get_tx( state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, RFBState); @@ -798,13 +798,13 @@ pub unsafe extern "C" fn rs_rfb_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_rfb_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, RFBState); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_rfb_tx_get_alstate_progress( +pub unsafe extern fn rs_rfb_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, RFBTransaction); @@ -821,7 +821,7 @@ export_tx_data_get!(rs_rfb_get_tx_data, RFBTransaction); export_state_data_get!(rs_rfb_get_state_data, RFBState); #[no_mangle] -pub unsafe extern "C" fn rs_rfb_register_parser() { +pub unsafe extern fn rs_rfb_register_parser() { let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, default_port: std::ptr::null(), diff --git a/rust/src/sip/detect.rs b/rust/src/sip/detect.rs index 63f636529a34..94d623af72de 100644 --- a/rust/src/sip/detect.rs +++ b/rust/src/sip/detect.rs @@ -22,10 +22,8 @@ use crate::sip::sip::SIPTransaction; use std::ptr; #[no_mangle] -pub unsafe extern "C" fn rs_sip_tx_get_method( - tx: &mut SIPTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32, +pub unsafe extern fn rs_sip_tx_get_method( + tx: &mut SIPTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref r) = tx.request { let m = &r.method; @@ -43,10 +41,8 @@ pub unsafe extern "C" fn rs_sip_tx_get_method( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_tx_get_uri( - tx: &mut SIPTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32, +pub unsafe extern fn rs_sip_tx_get_uri( + tx: &mut SIPTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref r) = tx.request { let p = &r.path; @@ -64,11 +60,8 @@ pub unsafe extern "C" fn rs_sip_tx_get_uri( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_tx_get_protocol( - tx: &mut SIPTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32, - direction: u8, +pub unsafe extern fn rs_sip_tx_get_protocol( + tx: &mut SIPTransaction, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8, ) -> u8 { match direction.into() { Direction::ToServer => { @@ -100,10 +93,8 @@ pub unsafe extern "C" fn rs_sip_tx_get_protocol( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_tx_get_stat_code( - tx: &mut SIPTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32, +pub unsafe extern fn rs_sip_tx_get_stat_code( + tx: &mut SIPTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref r) = tx.response { let c = &r.code; @@ -121,10 +112,8 @@ pub unsafe extern "C" fn rs_sip_tx_get_stat_code( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_tx_get_stat_msg( - tx: &mut SIPTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32, +pub unsafe extern fn rs_sip_tx_get_stat_msg( + tx: &mut SIPTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref r) = tx.response { let re = &r.reason; @@ -142,10 +131,8 @@ pub unsafe extern "C" fn rs_sip_tx_get_stat_msg( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_tx_get_request_line( - tx: &mut SIPTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32, +pub unsafe extern fn rs_sip_tx_get_request_line( + tx: &mut SIPTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref r) = tx.request_line { if !r.is_empty() { @@ -162,10 +149,8 @@ pub unsafe extern "C" fn rs_sip_tx_get_request_line( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_tx_get_response_line( - tx: &mut SIPTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32, +pub unsafe extern fn rs_sip_tx_get_response_line( + tx: &mut SIPTransaction, buffer: *mut *const u8, buffer_len: *mut u32, ) -> u8 { if let Some(ref r) = tx.response_line { if !r.is_empty() { diff --git a/rust/src/sip/log.rs b/rust/src/sip/log.rs index 792acfa49021..3f2afe334db2 100644 --- a/rust/src/sip/log.rs +++ b/rust/src/sip/log.rs @@ -49,6 +49,6 @@ fn log(tx: &SIPTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { } #[no_mangle] -pub extern "C" fn rs_sip_log_json(tx: &mut SIPTransaction, js: &mut JsonBuilder) -> bool { +pub extern fn rs_sip_log_json(tx: &mut SIPTransaction, js: &mut JsonBuilder) -> bool { log(tx, js).is_ok() -} \ No newline at end of file +} diff --git a/rust/src/sip/sip.rs b/rust/src/sip/sip.rs index 4e86f5ea476d..d4a49b964d7b 100755 --- a/rust/src/sip/sip.rs +++ b/rust/src/sip/sip.rs @@ -17,10 +17,10 @@ // written by Giuseppe Longo -use crate::frames::*; use crate::applayer::{self, *}; use crate::core; use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN}; +use crate::frames::*; use crate::sip::parser::*; use nom7::Err; use std; @@ -96,10 +96,7 @@ impl SIPState { } fn free_tx(&mut self, tx_id: u64) { - let tx = self - .transactions - .iter() - .position(|tx| tx.id == tx_id + 1); + let tx = self.transactions.iter().position(|tx| tx.id == tx_id + 1); debug_assert!(tx.is_some()); if let Some(idx) = tx { let _ = self.transactions.remove(idx); @@ -149,7 +146,13 @@ impl SIPState { fn parse_response(&mut self, flow: *const core::Flow, stream_slice: StreamSlice) -> bool { let input = stream_slice.as_slice(); - let _pdu = Frame::new(flow, &stream_slice, input, input.len() as i64, SIPFrameType::Pdu as u8); + let _pdu = Frame::new( + flow, + &stream_slice, + input, + input.len() as i64, + SIPFrameType::Pdu as u8, + ); SCLogDebug!("tc: pdu {:?}", _pdu); match sip_parse_response(input) { @@ -224,35 +227,54 @@ fn sip_frames_ts(flow: *const core::Flow, stream_slice: &StreamSlice, r: &Reques fn sip_frames_tc(flow: *const core::Flow, stream_slice: &StreamSlice, r: &Response) { let oi = stream_slice.as_slice(); - let _f = Frame::new(flow, stream_slice, oi, r.response_line_len as i64, SIPFrameType::ResponseLine as u8); - let hi = &oi[r.response_line_len as usize ..]; + let _f = Frame::new( + flow, + stream_slice, + oi, + r.response_line_len as i64, + SIPFrameType::ResponseLine as u8, + ); + let hi = &oi[r.response_line_len as usize..]; SCLogDebug!("tc: response_line {:?}", _f); - let _f = Frame::new(flow, stream_slice, hi, r.headers_len as i64, SIPFrameType::ResponseHeaders as u8); + let _f = Frame::new( + flow, + stream_slice, + hi, + r.headers_len as i64, + SIPFrameType::ResponseHeaders as u8, + ); SCLogDebug!("tc: response_headers {:?}", _f); if r.body_len > 0 { - let bi = &oi[r.body_offset as usize ..]; - let _f = Frame::new(flow, stream_slice, bi, r.body_len as i64, SIPFrameType::ResponseBody as u8); + let bi = &oi[r.body_offset as usize..]; + let _f = Frame::new( + flow, + stream_slice, + bi, + r.body_len as i64, + SIPFrameType::ResponseBody as u8, + ); SCLogDebug!("tc: response_body {:?}", _f); } } #[no_mangle] -pub extern "C" fn rs_sip_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_sip_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = SIPState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub extern "C" fn rs_sip_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_sip_state_free(state: *mut std::os::raw::c_void) { let mut state = unsafe { Box::from_raw(state as *mut SIPState) }; state.free(); } #[no_mangle] -pub unsafe extern "C" fn rs_sip_state_get_tx( - state: *mut std::os::raw::c_void, - tx_id: u64, +pub unsafe extern fn rs_sip_state_get_tx( + state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, SIPState); match state.get_tx_by_id(tx_id) { @@ -262,21 +284,20 @@ pub unsafe extern "C" fn rs_sip_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { +pub unsafe extern fn rs_sip_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, SIPState); state.tx_id } #[no_mangle] -pub unsafe extern "C" fn rs_sip_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { +pub unsafe extern fn rs_sip_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, SIPState); state.free_tx(tx_id); } #[no_mangle] -pub extern "C" fn rs_sip_tx_get_alstate_progress( - _tx: *mut std::os::raw::c_void, - _direction: u8, +pub extern fn rs_sip_tx_get_alstate_progress( + _tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { 1 } @@ -284,12 +305,8 @@ pub extern "C" fn rs_sip_tx_get_alstate_progress( static mut ALPROTO_SIP: AppProto = ALPROTO_UNKNOWN; #[no_mangle] -pub unsafe extern "C" fn rs_sip_probing_parser_ts( - _flow: *const Flow, - _direction: u8, - input: *const u8, - input_len: u32, - _rdir: *mut u8, +pub unsafe extern fn rs_sip_probing_parser_ts( + _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { let buf = build_slice!(input, input_len as usize); if sip_parse_request(buf).is_ok() { @@ -299,12 +316,8 @@ pub unsafe extern "C" fn rs_sip_probing_parser_ts( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_probing_parser_tc( - _flow: *const Flow, - _direction: u8, - input: *const u8, - input_len: u32, - _rdir: *mut u8, +pub unsafe extern fn rs_sip_probing_parser_tc( + _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { let buf = build_slice!(input, input_len as usize); if sip_parse_response(buf).is_ok() { @@ -314,24 +327,18 @@ pub unsafe extern "C" fn rs_sip_probing_parser_tc( } #[no_mangle] -pub unsafe extern "C" fn rs_sip_parse_request( - flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, +pub unsafe extern fn rs_sip_parse_request( + flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, SIPState); state.parse_request(flow, stream_slice).into() } #[no_mangle] -pub unsafe extern "C" fn rs_sip_parse_response( - flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, +pub unsafe extern fn rs_sip_parse_response( + flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, SIPState); state.parse_response(flow, stream_slice).into() @@ -343,7 +350,7 @@ export_state_data_get!(rs_sip_get_state_data, SIPState); const PARSER_NAME: &[u8] = b"sip\0"; #[no_mangle] -pub unsafe extern "C" fn rs_sip_register_parser() { +pub unsafe extern fn rs_sip_register_parser() { let default_port = CString::new("[5060,5061]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, diff --git a/rust/src/smb/auth.rs b/rust/src/smb/auth.rs index c5d20bba6e29..6d66547caafc 100644 --- a/rust/src/smb/auth.rs +++ b/rust/src/smb/auth.rs @@ -20,16 +20,17 @@ use crate::kerberos::*; use crate::smb::ntlmssp_records::*; use crate::smb::smb::*; -use nom7::{Err, IResult}; use der_parser6::ber::BerObjectContent; use der_parser6::der::{parse_der_oid, parse_der_sequence}; +use nom7::{Err, IResult}; -fn parse_secblob_get_spnego(blob: &[u8]) -> IResult<&[u8], &[u8], SecBlobError> -{ +fn parse_secblob_get_spnego(blob: &[u8]) -> IResult<&[u8], &[u8], SecBlobError> { let (rem, base_o) = der_parser6::parse_der(blob).map_err(Err::convert)?; SCLogDebug!("parse_secblob_get_spnego: base_o {:?}", base_o); let d = match base_o.content.as_slice() { - Err(_) => { return Err(Err::Error(SecBlobError::NotSpNego)); }, + Err(_) => { + return Err(Err::Error(SecBlobError::NotSpNego)); + } Ok(d) => d, }; let (next, o) = parse_der_oid(d).map_err(Err::convert)?; @@ -39,17 +40,17 @@ fn parse_secblob_get_spnego(blob: &[u8]) -> IResult<&[u8], &[u8], SecBlobError> Ok(oid) => oid, Err(_) => { return Err(Err::Error(SecBlobError::NotSpNego)); - }, + } }; SCLogDebug!("oid {}", oid.to_string()); match oid.to_string().as_str() { "1.3.6.1.5.5.2" => { SCLogDebug!("SPNEGO {}", oid); - }, + } _ => { return Err(Err::Error(SecBlobError::NotSpNego)); - }, + } } SCLogDebug!("parse_secblob_get_spnego: next {:?}", next); @@ -57,17 +58,16 @@ fn parse_secblob_get_spnego(blob: &[u8]) -> IResult<&[u8], &[u8], SecBlobError> Ok((rem, next)) } -fn parse_secblob_spnego_start(blob: &[u8]) -> IResult<&[u8], &[u8], SecBlobError> -{ +fn parse_secblob_spnego_start(blob: &[u8]) -> IResult<&[u8], &[u8], SecBlobError> { let (rem, o) = der_parser6::parse_der(blob).map_err(Err::convert)?; let d = match o.content.as_slice() { Ok(d) => { - SCLogDebug!("d: next data len {}",d.len()); + SCLogDebug!("d: next data len {}", d.len()); d - }, + } _ => { return Err(Err::Error(SecBlobError::NotSpNego)); - }, + } }; Ok((rem, d)) } @@ -78,27 +78,32 @@ pub struct SpnegoRequest { pub ntlmssp: Option, } -fn parse_secblob_spnego(blob: &[u8]) -> Option -{ +fn parse_secblob_spnego(blob: &[u8]) -> Option { let mut have_ntlmssp = false; let mut have_kerberos = false; - let mut kticket : Option = None; - let mut ntlmssp : Option = None; + let mut kticket: Option = None; + let mut ntlmssp: Option = None; let o = match parse_der_sequence(blob) { Ok((_, o)) => o, - _ => { return None; }, + _ => { + return None; + } }; for s in o { SCLogDebug!("s {:?}", s); let n = match s.content.as_slice() { Ok(s) => s, - _ => { continue; }, + _ => { + continue; + } }; let o = match der_parser6::parse_der(n) { - Ok((_,x)) => x, - _ => { continue; }, + Ok((_, x)) => x, + _ => { + continue; + } }; SCLogDebug!("o {:?}", o); match o.content { @@ -109,20 +114,40 @@ fn parse_secblob_spnego(blob: &[u8]) -> Option BerObjectContent::OID(ref oid) => { SCLogDebug!("OID {:?}", oid); match oid.to_string().as_str() { - "1.2.840.48018.1.2.2" => { SCLogDebug!("Microsoft Kerberos 5"); }, - "1.2.840.113554.1.2.2" => { SCLogDebug!("Kerberos 5"); have_kerberos = true; }, - "1.2.840.113554.1.2.2.1" => { SCLogDebug!("krb5-name"); }, - "1.2.840.113554.1.2.2.2" => { SCLogDebug!("krb5-principal"); }, - "1.2.840.113554.1.2.2.3" => { SCLogDebug!("krb5-user-to-user-mech"); }, - "1.3.6.1.4.1.311.2.2.10" => { SCLogDebug!("NTLMSSP"); have_ntlmssp = true; }, - "1.3.6.1.4.1.311.2.2.30" => { SCLogDebug!("NegoEx"); }, - _ => { SCLogDebug!("unexpected OID {:?}", oid); }, + "1.2.840.48018.1.2.2" => { + SCLogDebug!("Microsoft Kerberos 5"); + } + "1.2.840.113554.1.2.2" => { + SCLogDebug!("Kerberos 5"); + have_kerberos = true; + } + "1.2.840.113554.1.2.2.1" => { + SCLogDebug!("krb5-name"); + } + "1.2.840.113554.1.2.2.2" => { + SCLogDebug!("krb5-principal"); + } + "1.2.840.113554.1.2.2.3" => { + SCLogDebug!("krb5-user-to-user-mech"); + } + "1.3.6.1.4.1.311.2.2.10" => { + SCLogDebug!("NTLMSSP"); + have_ntlmssp = true; + } + "1.3.6.1.4.1.311.2.2.30" => { + SCLogDebug!("NegoEx"); + } + _ => { + SCLogDebug!("unexpected OID {:?}", oid); + } } - }, - _ => { SCLogDebug!("expected OID, got {:?}", se); }, + } + _ => { + SCLogDebug!("expected OID, got {:?}", se); + } } } - }, + } BerObjectContent::OctetString(os) => { if have_kerberos { if let Ok((_, t)) = parse_kerberos5_request(os) { @@ -134,8 +159,8 @@ fn parse_secblob_spnego(blob: &[u8]) -> Option SCLogDebug!("parsing expected NTLMSSP"); ntlmssp = parse_ntlmssp_blob(os); } - }, - _ => {}, + } + _ => {} } } @@ -146,7 +171,7 @@ fn parse_secblob_spnego(blob: &[u8]) -> Option Some(s) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct NtlmsspData { pub host: Vec, pub user: Vec, @@ -156,27 +181,29 @@ pub struct NtlmsspData { } /// take in blob, search for the header and parse it -fn parse_ntlmssp_blob(blob: &[u8]) -> Option -{ - let mut ntlmssp_data : Option = None; +fn parse_ntlmssp_blob(blob: &[u8]) -> Option { + let mut ntlmssp_data: Option = None; SCLogDebug!("NTLMSSP {:?}", blob); if let Ok((_, nd)) = parse_ntlmssp(blob) { - SCLogDebug!("NTLMSSP TYPE {}/{} nd {:?}", - nd.msg_type, &ntlmssp_type_string(nd.msg_type), nd); + SCLogDebug!( + "NTLMSSP TYPE {}/{} nd {:?}", + nd.msg_type, + &ntlmssp_type_string(nd.msg_type), + nd + ); match nd.msg_type { - NTLMSSP_NEGOTIATE => { - }, + NTLMSSP_NEGOTIATE => {} NTLMSSP_AUTH => { if let Ok((_, ad)) = parse_ntlm_auth_record(nd.data) { SCLogDebug!("auth data {:?}", ad); let mut host = ad.host.to_vec(); - host.retain(|&i|i != 0x00); + host.retain(|&i| i != 0x00); let mut user = ad.user.to_vec(); - user.retain(|&i|i != 0x00); + user.retain(|&i| i != 0x00); let mut domain = ad.domain.to_vec(); - domain.retain(|&i|i != 0x00); - + domain.retain(|&i| i != 0x00); + let d = NtlmsspData { host, user, @@ -186,47 +213,38 @@ fn parse_ntlmssp_blob(blob: &[u8]) -> Option }; ntlmssp_data = Some(d); } - }, - _ => {}, + } + _ => {} } } return ntlmssp_data; } // if spnego parsing fails try to fall back to ntlmssp -pub fn parse_secblob(blob: &[u8]) -> Option -{ +pub fn parse_secblob(blob: &[u8]) -> Option { match parse_secblob_get_spnego(blob) { - Ok((_, spnego)) => { - match parse_secblob_spnego_start(spnego) { - Ok((_, spnego_start)) => { - parse_secblob_spnego(spnego_start) - }, - _ => { - match parse_ntlmssp_blob(blob) { - Some(n) => { - let s = SpnegoRequest { - krb: None, - ntlmssp: Some(n), - }; - Some(s) - }, - None => { None }, - } - }, - } - }, - _ => { - match parse_ntlmssp_blob(blob) { + Ok((_, spnego)) => match parse_secblob_spnego_start(spnego) { + Ok((_, spnego_start)) => parse_secblob_spnego(spnego_start), + _ => match parse_ntlmssp_blob(blob) { Some(n) => { let s = SpnegoRequest { krb: None, - ntlmssp: Some(n), + ntlmssp: Some(n), }; Some(s) - }, - None => { None }, + } + None => None, + }, + }, + _ => match parse_ntlmssp_blob(blob) { + Some(n) => { + let s = SpnegoRequest { + krb: None, + ntlmssp: Some(n), + }; + Some(s) } + None => None, }, } } diff --git a/rust/src/smb/dcerpc.rs b/rust/src/smb/dcerpc.rs index b4c5749eac46..ec911c6fcd54 100644 --- a/rust/src/smb/dcerpc.rs +++ b/rust/src/smb/dcerpc.rs @@ -17,13 +17,13 @@ // written by Victor Julien -use uuid; -use crate::smb::smb::*; -use crate::smb::smb2::*; +use crate::dcerpc::dcerpc::*; use crate::smb::dcerpc_records::*; use crate::smb::events::*; -use crate::dcerpc::dcerpc::*; +use crate::smb::smb::*; +use crate::smb::smb2::*; use crate::smb::smb_status::*; +use uuid; impl SMBCommonHdr { /// helper for DCERPC tx tracking. Check if we need @@ -37,21 +37,21 @@ impl SMBCommonHdr { 2 => { let (_, cmd2) = vercmd.get_smb2_cmd(); let x = match cmd2 { - SMB2_COMMAND_READ => { 0 }, - SMB2_COMMAND_WRITE => { 0 }, - SMB2_COMMAND_IOCTL => { self.msg_id }, - _ => { self.msg_id }, + SMB2_COMMAND_READ => 0, + SMB2_COMMAND_WRITE => 0, + SMB2_COMMAND_IOCTL => self.msg_id, + _ => self.msg_id, }; use_msg_id = x; - }, + } 1 => { SCLogDebug!("FIXME TODO"); //let (_, cmd1) = vercmd.get_smb1_cmd(); //if cmd1 != SMB1_COMMAND_IOCTL { use_msg_id = 0; //} - }, - _ => { }, + } + _ => {} } SMBCommonHdr { ssn_id: self.ssn_id, @@ -108,10 +108,10 @@ impl SMBTransactionDCERPC { req_set: true, call_id, ..Default::default() - } + }; } fn new_response(call_id: u32) -> Self { - return Self { + return Self { call_id, ..Default::default() }; @@ -123,14 +123,15 @@ impl SMBTransactionDCERPC { } impl SMBState { - fn new_dcerpc_tx(&mut self, hdr: SMBCommonHdr, vercmd: SMBVerCmdStat, cmd: u8, call_id: u32) - -> &mut SMBTransaction - { + fn new_dcerpc_tx( + &mut self, hdr: SMBCommonHdr, vercmd: SMBVerCmdStat, cmd: u8, call_id: u32, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.hdr = hdr; tx.vercmd = vercmd; tx.type_data = Some(SMBTransactionTypeData::DCERPC( - SMBTransactionDCERPC::new_request(cmd, call_id))); + SMBTransactionDCERPC::new_request(cmd, call_id), + )); SCLogDebug!("SMB: TX DCERPC created: ID {} hdr {:?}", tx.id, tx.hdr); self.transactions.push_back(tx); @@ -138,14 +139,15 @@ impl SMBState { return tx_ref.unwrap(); } - fn new_dcerpc_tx_for_response(&mut self, hdr: SMBCommonHdr, vercmd: SMBVerCmdStat, call_id: u32) - -> &mut SMBTransaction - { + fn new_dcerpc_tx_for_response( + &mut self, hdr: SMBCommonHdr, vercmd: SMBVerCmdStat, call_id: u32, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.hdr = hdr; tx.vercmd = vercmd; tx.type_data = Some(SMBTransactionTypeData::DCERPC( - SMBTransactionDCERPC::new_response(call_id))); + SMBTransactionDCERPC::new_response(call_id), + )); SCLogDebug!("SMB: TX DCERPC created: ID {} hdr {:?}", tx.id, tx.hdr); self.transactions.push_back(tx); @@ -153,20 +155,18 @@ impl SMBState { return tx_ref.unwrap(); } - fn get_dcerpc_tx(&mut self, hdr: &SMBCommonHdr, vercmd: &SMBVerCmdStat, call_id: u32) - -> Option<&mut SMBTransaction> - { + fn get_dcerpc_tx( + &mut self, hdr: &SMBCommonHdr, vercmd: &SMBVerCmdStat, call_id: u32, + ) -> Option<&mut SMBTransaction> { let dce_hdr = hdr.to_dcerpc(vercmd); SCLogDebug!("looking for {:?}", dce_hdr); for tx in &mut self.transactions { - let found = dce_hdr.compare(&tx.hdr.to_dcerpc(vercmd)) && - match tx.type_data { - Some(SMBTransactionTypeData::DCERPC(ref x)) => { - x.call_id == call_id - }, - _ => { false }, - }; + let found = dce_hdr.compare(&tx.hdr.to_dcerpc(vercmd)) + && match tx.type_data { + Some(SMBTransactionTypeData::DCERPC(ref x)) => x.call_id == call_id, + _ => false, + }; if found { return Some(tx); } @@ -178,19 +178,22 @@ impl SMBState { /// Handle DCERPC request data from a WRITE, IOCTL or TRANS record. /// return bool indicating whether an tx has been created/updated. /// -pub fn smb_write_dcerpc_record(state: &mut SMBState, - vercmd: SMBVerCmdStat, - hdr: SMBCommonHdr, - data: &[u8]) -> bool -{ - let mut bind_ifaces : Option> = None; +pub fn smb_write_dcerpc_record( + state: &mut SMBState, vercmd: SMBVerCmdStat, hdr: SMBCommonHdr, data: &[u8], +) -> bool { + let mut bind_ifaces: Option> = None; let mut is_bind = false; SCLogDebug!("called for {} bytes of data", data.len()); match parse_dcerpc_record(data) { Ok((_, dcer)) => { - SCLogDebug!("DCERPC: version {}.{} write data {} => {:?}", - dcer.version_major, dcer.version_minor, dcer.data.len(), dcer); + SCLogDebug!( + "DCERPC: version {}.{} write data {} => {:?}", + dcer.version_major, + dcer.version_minor, + dcer.data.len(), + dcer + ); /* if this isn't the first frag, simply update the existing * tx with the additional stub data */ @@ -200,9 +203,15 @@ pub fn smb_write_dcerpc_record(state: &mut SMBState, Ok((_, recr)) => { let found = match state.get_dcerpc_tx(&hdr, &vercmd, dcer.call_id) { Some(tx) => { - SCLogDebug!("previous CMD {} found at tx {} => {:?}", - dcer.packet_type, tx.id, tx); - if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = tx.type_data { + SCLogDebug!( + "previous CMD {} found at tx {} => {:?}", + dcer.packet_type, + tx.id, + tx + ); + if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = + tx.type_data + { SCLogDebug!("additional frag of size {}", recr.data.len()); tdn.stub_data_ts.extend_from_slice(recr.data); tdn.frag_cnt_ts += 1; @@ -212,51 +221,60 @@ pub fn smb_write_dcerpc_record(state: &mut SMBState, SCLogDebug!("last frag set, so request side of DCERPC closed"); tx.request_done = true; } else { - SCLogDebug!("NOT last frag, so request side of DCERPC remains open"); + SCLogDebug!( + "NOT last frag, so request side of DCERPC remains open" + ); } true - }, + } None => { SCLogDebug!("NO previous CMD {} found", dcer.packet_type); false - }, + } }; return found; - }, + } _ => { state.set_event(SMBEvent::MalformedData); return false; - }, + } } } let tx = state.new_dcerpc_tx(hdr, vercmd, dcer.packet_type, dcer.call_id); match dcer.packet_type { DCERPC_TYPE_REQUEST => { - match parse_dcerpc_request_record(dcer.data, dcer.frag_len, dcer.little_endian) { + match parse_dcerpc_request_record(dcer.data, dcer.frag_len, dcer.little_endian) + { Ok((_, recr)) => { SCLogDebug!("DCERPC: REQUEST {:?}", recr); - if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = tx.type_data { + if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = tx.type_data + { SCLogDebug!("first frag size {}", recr.data.len()); tdn.stub_data_ts.extend_from_slice(recr.data); tdn.opnum = recr.opnum; tdn.context_id = recr.context_id; tdn.frag_cnt_ts += 1; - SCLogDebug!("DCERPC: REQUEST opnum {} stub data len {}", - tdn.opnum, tdn.stub_data_ts.len()); + SCLogDebug!( + "DCERPC: REQUEST opnum {} stub data len {}", + tdn.opnum, + tdn.stub_data_ts.len() + ); } if dcer.last_frag { tx.request_done = true; } else { - SCLogDebug!("NOT last frag, so request side of DCERPC remains open"); + SCLogDebug!( + "NOT last frag, so request side of DCERPC remains open" + ); } - }, + } _ => { tx.set_event(SMBEvent::MalformedData); tx.request_done = true; - }, + } } - }, + } DCERPC_TYPE_BIND => { let brec = if dcer.little_endian { parse_dcerpc_bind_record(dcer.data) @@ -272,43 +290,63 @@ pub fn smb_write_dcerpc_record(state: &mut SMBState, let mut ifaces: Vec = Vec::new(); for i in bindr.ifaces { let x = if dcer.little_endian { - vec![i.iface[3], i.iface[2], i.iface[1], i.iface[0], - i.iface[5], i.iface[4], i.iface[7], i.iface[6], - i.iface[8], i.iface[9], i.iface[10], i.iface[11], - i.iface[12], i.iface[13], i.iface[14], i.iface[15]] + vec![ + i.iface[3], + i.iface[2], + i.iface[1], + i.iface[0], + i.iface[5], + i.iface[4], + i.iface[7], + i.iface[6], + i.iface[8], + i.iface[9], + i.iface[10], + i.iface[11], + i.iface[12], + i.iface[13], + i.iface[14], + i.iface[15], + ] } else { i.iface.to_vec() }; let uuid_str = uuid::Uuid::from_slice(&x.clone()); - let _uuid_str = uuid_str.map(|uuid_str| uuid_str.to_hyphenated().to_string()).unwrap(); - let d = DCERPCIface::new(x,i.ver,i.ver_min); - SCLogDebug!("UUID {} version {}/{} bytes {:?}", - _uuid_str, - i.ver, i.ver_min,i.iface); + let _uuid_str = uuid_str + .map(|uuid_str| uuid_str.to_hyphenated().to_string()) + .unwrap(); + let d = DCERPCIface::new(x, i.ver, i.ver_min); + SCLogDebug!( + "UUID {} version {}/{} bytes {:?}", + _uuid_str, + i.ver, + i.ver_min, + i.iface + ); ifaces.push(d); } bind_ifaces = Some(ifaces); } - }, + } _ => { tx.set_event(SMBEvent::MalformedData); - }, + } } tx.request_done = true; } 21..=255 => { tx.set_event(SMBEvent::MalformedData); tx.request_done = true; - }, + } _ => { // valid type w/o special processing tx.request_done = true; - }, + } } - }, + } _ => { state.set_event(SMBEvent::MalformedData); - }, + } } if is_bind { @@ -324,12 +362,9 @@ pub fn smb_write_dcerpc_record(state: &mut SMBState, /// Update TX for bind ack. Needs to update both tx and state. /// fn smb_dcerpc_response_bindack( - state: &mut SMBState, - vercmd: SMBVerCmdStat, - hdr: SMBCommonHdr, - dcer: &DceRpcRecord, - ntstatus: u32) -{ + state: &mut SMBState, vercmd: SMBVerCmdStat, hdr: SMBCommonHdr, dcer: &DceRpcRecord, + ntstatus: u32, +) { match parse_dcerpc_bindack_record(dcer.data) { Ok((_, bindackr)) => { SCLogDebug!("SMB READ BINDACK {:?}", bindackr); @@ -342,7 +377,7 @@ fn smb_dcerpc_response_bindack( tx.vercmd.set_ntstatus(ntstatus); tx.response_done = true; true - }, + } None => false, }; if found { @@ -357,17 +392,16 @@ fn smb_dcerpc_response_bindack( } } } - }, + } _ => { state.set_event(SMBEvent::MalformedData); - }, + } } } -fn smb_read_dcerpc_record_error(state: &mut SMBState, - hdr: SMBCommonHdr, vercmd: SMBVerCmdStat, ntstatus: u32) - -> bool -{ +fn smb_read_dcerpc_record_error( + state: &mut SMBState, hdr: SMBCommonHdr, vercmd: SMBVerCmdStat, ntstatus: u32, +) -> bool { let ver = vercmd.get_version(); let cmd = if ver == 2 { let (_, c) = vercmd.get_smb2_cmd(); @@ -383,42 +417,37 @@ fn smb_read_dcerpc_record_error(state: &mut SMBState, tx.set_status(ntstatus, false); tx.response_done = true; true - }, + } None => { SCLogDebug!("NOT found"); false - }, + } }; return found; } -fn dcerpc_response_handle(tx: &mut SMBTransaction, - vercmd: SMBVerCmdStat, - dcer: &DceRpcRecord) -{ +fn dcerpc_response_handle(tx: &mut SMBTransaction, vercmd: SMBVerCmdStat, dcer: &DceRpcRecord) { let (_, ntstatus) = vercmd.get_ntstatus(); match dcer.packet_type { - DCERPC_TYPE_RESPONSE => { - match parse_dcerpc_response_record(dcer.data, dcer.frag_len) { - Ok((_, respr)) => { - SCLogDebug!("SMBv1 READ RESPONSE {:?}", respr); - if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = tx.type_data { - SCLogDebug!("CMD 11 found at tx {}", tx.id); - tdn.set_result(DCERPC_TYPE_RESPONSE); - tdn.stub_data_tc.extend_from_slice(respr.data); - tdn.frag_cnt_tc += 1; - } - tx.vercmd.set_ntstatus(ntstatus); - tx.response_done = dcer.last_frag; - }, - _ => { - tx.set_event(SMBEvent::MalformedData); - }, + DCERPC_TYPE_RESPONSE => match parse_dcerpc_response_record(dcer.data, dcer.frag_len) { + Ok((_, respr)) => { + SCLogDebug!("SMBv1 READ RESPONSE {:?}", respr); + if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = tx.type_data { + SCLogDebug!("CMD 11 found at tx {}", tx.id); + tdn.set_result(DCERPC_TYPE_RESPONSE); + tdn.stub_data_tc.extend_from_slice(respr.data); + tdn.frag_cnt_tc += 1; + } + tx.vercmd.set_ntstatus(ntstatus); + tx.response_done = dcer.last_frag; + } + _ => { + tx.set_event(SMBEvent::MalformedData); } }, DCERPC_TYPE_BINDACK => { // handled elsewhere - }, + } 21..=255 => { if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = tx.type_data { tdn.set_result(dcer.packet_type); @@ -427,24 +456,22 @@ fn dcerpc_response_handle(tx: &mut SMBTransaction, tx.response_done = true; tx.set_event(SMBEvent::MalformedData); } - _ => { // valid type w/o special processing + _ => { + // valid type w/o special processing if let Some(SMBTransactionTypeData::DCERPC(ref mut tdn)) = tx.type_data { tdn.set_result(dcer.packet_type); } tx.vercmd.set_ntstatus(ntstatus); tx.response_done = true; - }, + } } } /// Handle DCERPC reply record. Called for READ, TRANS, IOCTL /// -pub fn smb_read_dcerpc_record(state: &mut SMBState, - vercmd: SMBVerCmdStat, - hdr: SMBCommonHdr, - guid: &[u8], - indata: &[u8]) -> bool -{ +pub fn smb_read_dcerpc_record( + state: &mut SMBState, vercmd: SMBVerCmdStat, hdr: SMBCommonHdr, guid: &[u8], indata: &[u8], +) -> bool { let (_, ntstatus) = vercmd.get_ntstatus(); if ntstatus != SMB_NTSTATUS_SUCCESS && ntstatus != SMB_NTSTATUS_BUFFER_OVERFLOW { @@ -453,8 +480,10 @@ pub fn smb_read_dcerpc_record(state: &mut SMBState, SCLogDebug!("lets first see if we have prior data"); // msg_id 0 as this data crosses cmd/reply pairs - let ehdr = SMBHashKeyHdrGuid::new(SMBCommonHdr::new(SMBHDR_TYPE_TRANS_FRAG, - hdr.ssn_id, hdr.tree_id, 0_u64), guid.to_vec()); + let ehdr = SMBHashKeyHdrGuid::new( + SMBCommonHdr::new(SMBHDR_TYPE_TRANS_FRAG, hdr.ssn_id, hdr.tree_id, 0_u64), + guid.to_vec(), + ); let mut prevdata = match state.ssnguid2vec_map.remove(&ehdr) { Some(s) => s, None => Vec::new(), @@ -467,18 +496,25 @@ pub fn smb_read_dcerpc_record(state: &mut SMBState, if data.is_empty() { SCLogDebug!("weird: no DCERPC data"); // TODO - // TODO set event? + // TODO set event? return false; - } else { match parse_dcerpc_record(&data) { Ok((_, dcer)) => { - SCLogDebug!("DCERPC: version {}.{} read data {} => {:?}", - dcer.version_major, dcer.version_minor, dcer.data.len(), dcer); + SCLogDebug!( + "DCERPC: version {}.{} read data {} => {:?}", + dcer.version_major, + dcer.version_minor, + dcer.data.len(), + dcer + ); if ntstatus == SMB_NTSTATUS_BUFFER_OVERFLOW && data.len() < dcer.frag_len as usize { - SCLogDebug!("short record {} < {}: storing partial data in state", - data.len(), dcer.frag_len); + SCLogDebug!( + "short record {} < {}: storing partial data in state", + data.len(), + dcer.frag_len + ); state.ssnguid2vec_map.insert(ehdr, data.to_vec()); return true; // TODO review } @@ -492,21 +528,21 @@ pub fn smb_read_dcerpc_record(state: &mut SMBState, Some(tx) => { dcerpc_response_handle(tx, vercmd.clone(), &dcer); true - }, + } None => { SCLogDebug!("no tx"); false - }, + } }; if !found { // pick up DCERPC tx even if we missed the request let tx = state.new_dcerpc_tx_for_response(hdr, vercmd.clone(), dcer.call_id); dcerpc_response_handle(tx, vercmd, &dcer); } - }, + } _ => { malformed = true; - }, + } } } @@ -518,16 +554,17 @@ pub fn smb_read_dcerpc_record(state: &mut SMBState, } /// Try to find out if the input data looks like DCERPC -pub fn smb_dcerpc_probe(data: &[u8]) -> bool -{ +pub fn smb_dcerpc_probe(data: &[u8]) -> bool { if let Ok((_, recr)) = parse_dcerpc_record(data) { SCLogDebug!("SMB: could be DCERPC {:?}", recr); - if recr.version_major == 5 && recr.version_minor < 3 && - recr.frag_len > 0 && recr.packet_type <= 20 - { - SCLogDebug!("SMB: looks like we have dcerpc"); - return true; - } + if recr.version_major == 5 + && recr.version_minor < 3 + && recr.frag_len > 0 + && recr.packet_type <= 20 + { + SCLogDebug!("SMB: looks like we have dcerpc"); + return true; + } } return false; } diff --git a/rust/src/smb/dcerpc_records.rs b/rust/src/smb/dcerpc_records.rs index 0c8c17fe18c4..66eeee57cc3b 100644 --- a/rust/src/smb/dcerpc_records.rs +++ b/rust/src/smb/dcerpc_records.rs @@ -21,21 +21,21 @@ use nom7::bits::streaming::take as take_bits; use nom7::bytes::streaming::take; use nom7::combinator::{cond, rest}; use nom7::multi::count; +use nom7::number::streaming::{be_u16, le_u16, le_u32, le_u8, u16, u32}; use nom7::number::Endianness; -use nom7::number::streaming::{be_u16, le_u8, le_u16, le_u32, u16, u32}; use nom7::sequence::tuple; use nom7::{Err, IResult}; -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct DceRpcResponseRecord<'a> { - pub data: &'a[u8], + pub data: &'a [u8], } /// parse a packet type 'response' DCERPC record. Implemented /// as function to be able to pass the fraglen in. -pub fn parse_dcerpc_response_record(i:&[u8], frag_len: u16 ) - -> IResult<&[u8], DceRpcResponseRecord, SmbError> -{ +pub fn parse_dcerpc_response_record( + i: &[u8], frag_len: u16, +) -> IResult<&[u8], DceRpcResponseRecord, SmbError> { if frag_len < 24 { return Err(Err::Error(SmbError::RecordTooSmall)); } @@ -45,33 +45,41 @@ pub fn parse_dcerpc_response_record(i:&[u8], frag_len: u16 ) Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct DceRpcRequestRecord<'a> { pub opnum: u16, pub context_id: u16, - pub data: &'a[u8], + pub data: &'a [u8], } /// parse a packet type 'request' DCERPC record. Implemented /// as function to be able to pass the fraglen in. -pub fn parse_dcerpc_request_record(i:&[u8], frag_len: u16, little: bool) - -> IResult<&[u8], DceRpcRequestRecord, SmbError> -{ +pub fn parse_dcerpc_request_record( + i: &[u8], frag_len: u16, little: bool, +) -> IResult<&[u8], DceRpcRequestRecord, SmbError> { if frag_len < 24 { return Err(Err::Error(SmbError::RecordTooSmall)); } let (i, _) = take(4_usize)(i)?; - let endian = if little { Endianness::Little } else { Endianness::Big }; + let endian = if little { + Endianness::Little + } else { + Endianness::Big + }; let (i, context_id) = u16(endian)(i)?; let (i, opnum) = u16(endian)(i)?; let (i, data) = take(frag_len - 24)(i)?; - let record = DceRpcRequestRecord { opnum, context_id, data }; + let record = DceRpcRequestRecord { + opnum, + context_id, + data, + }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct DceRpcBindIface<'a> { - pub iface: &'a[u8], + pub iface: &'a [u8], pub ver: u16, pub ver_min: u16, } @@ -85,7 +93,7 @@ pub fn parse_dcerpc_bind_iface(i: &[u8]) -> IResult<&[u8], DceRpcBindIface> { let (i, ver_min) = le_u16(i)?; let (i, _) = take(20_usize)(i)?; let res = DceRpcBindIface { - iface:interface, + iface: interface, ver, ver_min, }; @@ -101,14 +109,14 @@ pub fn parse_dcerpc_bind_iface_big(i: &[u8]) -> IResult<&[u8], DceRpcBindIface> let (i, ver) = be_u16(i)?; let (i, _) = take(20_usize)(i)?; let res = DceRpcBindIface { - iface:interface, + iface: interface, ver, ver_min, }; Ok((i, res)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct DceRpcBindRecord<'a> { pub num_ctx_items: u8, pub ifaces: Vec>, @@ -142,11 +150,11 @@ pub fn parse_dcerpc_bind_record_big(i: &[u8]) -> IResult<&[u8], DceRpcBindRecord Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct DceRpcBindAckResult<'a> { pub ack_result: u16, pub ack_reason: u16, - pub transfer_syntax: &'a[u8], + pub transfer_syntax: &'a [u8], pub syntax_version: u32, } @@ -164,7 +172,7 @@ pub fn parse_dcerpc_bindack_result(i: &[u8]) -> IResult<&[u8], DceRpcBindAckResu Ok((i, res)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct DceRpcBindAckRecord<'a> { pub num_results: u8, pub results: Vec>, @@ -176,7 +184,10 @@ pub fn parse_dcerpc_bindack_record(i: &[u8]) -> IResult<&[u8], DceRpcBindAckReco let (i, _assoc_group) = take(4_usize)(i)?; let (i, sec_addr_len) = le_u16(i)?; let (i, _) = take(sec_addr_len)(i)?; - let (i, _) = cond((sec_addr_len+2) % 4 != 0, take(4 - (sec_addr_len+2) % 4))(i)?; + let (i, _) = cond( + (sec_addr_len + 2) % 4 != 0, + take(4 - (sec_addr_len + 2) % 4), + )(i)?; let (i, num_results) = le_u8(i)?; let (i, _) = take(3_usize)(i)?; // padding let (i, results) = count(parse_dcerpc_bindack_result, num_results as usize)(i)?; @@ -187,7 +198,7 @@ pub fn parse_dcerpc_bindack_record(i: &[u8]) -> IResult<&[u8], DceRpcBindAckReco Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct DceRpcRecord<'a> { pub version_major: u8, pub version_minor: u8, @@ -202,22 +213,22 @@ pub struct DceRpcRecord<'a> { pub packet_type: u8, pub call_id: u32, - pub data: &'a[u8], + pub data: &'a [u8], } -fn parse_dcerpc_flags1(i:&[u8]) -> IResult<&[u8],(u8,u8,u8)> { +fn parse_dcerpc_flags1(i: &[u8]) -> IResult<&[u8], (u8, u8, u8)> { bits(tuple(( take_bits(6u8), - take_bits(1u8), // last (1) + take_bits(1u8), // last (1) take_bits(1u8), )))(i) } -fn parse_dcerpc_flags2(i:&[u8]) -> IResult<&[u8],(u32,u32,u32)> { +fn parse_dcerpc_flags2(i: &[u8]) -> IResult<&[u8], (u32, u32, u32)> { bits(tuple(( - take_bits(3u32), - take_bits(1u32), // endianness - take_bits(28u32), + take_bits(3u32), + take_bits(1u32), // endianness + take_bits(28u32), )))(i) } @@ -227,7 +238,11 @@ pub fn parse_dcerpc_record(i: &[u8]) -> IResult<&[u8], DceRpcRecord> { let (i, packet_type) = le_u8(i)?; let (i, packet_flags) = parse_dcerpc_flags1(i)?; let (i, data_rep) = parse_dcerpc_flags2(i)?; - let endian = if data_rep.1 == 0 { Endianness::Big } else { Endianness::Little }; + let endian = if data_rep.1 == 0 { + Endianness::Big + } else { + Endianness::Little + }; let (i, frag_len) = u16(endian)(i)?; let (i, _auth) = u16(endian)(i)?; let (i, call_id) = u32(endian)(i)?; diff --git a/rust/src/smb/debug.rs b/rust/src/smb/debug.rs index 86799dd7fa1d..56eb26fd400a 100644 --- a/rust/src/smb/debug.rs +++ b/rust/src/smb/debug.rs @@ -19,7 +19,7 @@ use crate::smb::smb::*; impl SMBState { #[cfg(not(feature = "debug"))] - pub fn _debug_tx_stats(&self) { } + pub fn _debug_tx_stats(&self) {} #[cfg(feature = "debug")] pub fn _debug_tx_stats(&self) { @@ -27,7 +27,12 @@ impl SMBState { let txf = self.transactions.front().unwrap(); let txl = self.transactions.back().unwrap(); - SCLogDebug!("TXs {} MIN {} MAX {}", self.transactions.len(), txf.id, txl.id); + SCLogDebug!( + "TXs {} MIN {} MAX {}", + self.transactions.len(), + txf.id, + txl.id + ); SCLogDebug!("- OLD tx.id {}: {:?}", txf.id, txf); SCLogDebug!("- NEW tx.id {}: {:?}", txl.id, txl); self._dump_txs(); @@ -35,7 +40,7 @@ impl SMBState { } #[cfg(not(feature = "debug"))] - pub fn _dump_txs(&self) { } + pub fn _dump_txs(&self) {} #[cfg(feature = "debug")] pub fn _dump_txs(&self) { let len = self.transactions.len(); @@ -52,20 +57,35 @@ impl SMBState { match tx.type_data { Some(SMBTransactionTypeData::FILE(ref d)) => { - SCLogDebug!("idx {} tx id {} progress {}/{} filename {} type_data {:?}", - i, tx.id, tx.request_done, tx.response_done, - String::from_utf8_lossy(&d.file_name), tx.type_data); - }, + SCLogDebug!( + "idx {} tx id {} progress {}/{} filename {} type_data {:?}", + i, + tx.id, + tx.request_done, + tx.response_done, + String::from_utf8_lossy(&d.file_name), + tx.type_data + ); + } _ => { - SCLogDebug!("idx {} tx id {} ver:{} cmd:{} progress {}/{} type_data {:?} tx {:?}", - i, tx.id, ver, _smbcmd, tx.request_done, tx.response_done, tx.type_data, tx); - }, + SCLogDebug!( + "idx {} tx id {} ver:{} cmd:{} progress {}/{} type_data {:?} tx {:?}", + i, + tx.id, + ver, + _smbcmd, + tx.request_done, + tx.response_done, + tx.type_data, + tx + ); + } } } } #[cfg(not(feature = "debug"))] - pub fn _debug_state_stats(&self) { } + pub fn _debug_state_stats(&self) {} #[cfg(feature = "debug")] pub fn _debug_state_stats(&self) { diff --git a/rust/src/smb/detect.rs b/rust/src/smb/detect.rs index c85a6f59ce33..41aa0fa7ddd6 100644 --- a/rust/src/smb/detect.rs +++ b/rust/src/smb/detect.rs @@ -15,19 +15,17 @@ * 02110-1301, USA. */ -use std::ptr; use crate::core::*; -use crate::smb::smb::*; -use crate::dcerpc::detect::{DCEIfaceData, DCEOpnumData, DETECT_DCE_OPNUM_RANGE_UNINITIALIZED}; use crate::dcerpc::dcerpc::DCERPC_TYPE_REQUEST; +use crate::dcerpc::detect::{DCEIfaceData, DCEOpnumData, DETECT_DCE_OPNUM_RANGE_UNINITIALIZED}; use crate::detect::uint::detect_match_uint; +use crate::smb::smb::*; +use std::ptr; #[no_mangle] -pub unsafe extern "C" fn rs_smb_tx_get_share(tx: &mut SMBTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32) - -> u8 -{ +pub unsafe extern fn rs_smb_tx_get_share( + tx: &mut SMBTransaction, buffer: *mut *const u8, buffer_len: *mut u32, +) -> u8 { if let Some(SMBTransactionTypeData::TREECONNECT(ref x)) = tx.type_data { SCLogDebug!("is_pipe {}", x.is_pipe); if !x.is_pipe { @@ -43,11 +41,9 @@ pub unsafe extern "C" fn rs_smb_tx_get_share(tx: &mut SMBTransaction, } #[no_mangle] -pub unsafe extern "C" fn rs_smb_tx_get_named_pipe(tx: &mut SMBTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32) - -> u8 -{ +pub unsafe extern fn rs_smb_tx_get_named_pipe( + tx: &mut SMBTransaction, buffer: *mut *const u8, buffer_len: *mut u32, +) -> u8 { if let Some(SMBTransactionTypeData::TREECONNECT(ref x)) = tx.type_data { SCLogDebug!("is_pipe {}", x.is_pipe); if x.is_pipe { @@ -63,12 +59,9 @@ pub unsafe extern "C" fn rs_smb_tx_get_named_pipe(tx: &mut SMBTransaction, } #[no_mangle] -pub unsafe extern "C" fn rs_smb_tx_get_stub_data(tx: &mut SMBTransaction, - direction: u8, - buffer: *mut *const u8, - buffer_len: *mut u32) - -> u8 -{ +pub unsafe extern fn rs_smb_tx_get_stub_data( + tx: &mut SMBTransaction, direction: u8, buffer: *mut *const u8, buffer_len: *mut u32, +) -> u8 { if let Some(SMBTransactionTypeData::DCERPC(ref x)) = tx.type_data { let vref = if direction == Direction::ToServer as u8 { &x.stub_data_ts @@ -88,10 +81,9 @@ pub unsafe extern "C" fn rs_smb_tx_get_stub_data(tx: &mut SMBTransaction, } #[no_mangle] -pub extern "C" fn rs_smb_tx_match_dce_opnum(tx: &mut SMBTransaction, - dce_data: &mut DCEOpnumData) - -> u8 -{ +pub extern fn rs_smb_tx_match_dce_opnum( + tx: &mut SMBTransaction, dce_data: &mut DCEOpnumData, +) -> u8 { SCLogDebug!("rs_smb_tx_get_dce_opnum: start"); if let Some(SMBTransactionTypeData::DCERPC(ref x)) = tx.type_data { if x.req_cmd == DCERPC_TYPE_REQUEST { @@ -115,17 +107,13 @@ pub extern "C" fn rs_smb_tx_match_dce_opnum(tx: &mut SMBTransaction, * dce_opnum and dce_stub_data) * - only match on approved ifaces (so ack_result == 0) */ #[no_mangle] -pub extern "C" fn rs_smb_tx_get_dce_iface(state: &mut SMBState, - tx: &mut SMBTransaction, - dce_data: &mut DCEIfaceData) - -> u8 -{ +pub extern fn rs_smb_tx_get_dce_iface( + state: &mut SMBState, tx: &mut SMBTransaction, dce_data: &mut DCEIfaceData, +) -> u8 { let if_uuid = dce_data.if_uuid.as_slice(); let is_dcerpc_request = match tx.type_data { - Some(SMBTransactionTypeData::DCERPC(ref x)) => { - x.req_cmd == DCERPC_TYPE_REQUEST - }, - _ => { false }, + Some(SMBTransactionTypeData::DCERPC(ref x)) => x.req_cmd == DCERPC_TYPE_REQUEST, + _ => false, }; if !is_dcerpc_request { return 0; @@ -134,13 +122,18 @@ pub extern "C" fn rs_smb_tx_get_dce_iface(state: &mut SMBState, Some(ref x) => x, _ => { return 0; - }, + } }; SCLogDebug!("looking for UUID {:?}", if_uuid); for i in ifaces { - SCLogDebug!("stored UUID {:?} acked {} ack_result {}", i, i.acked, i.ack_result); + SCLogDebug!( + "stored UUID {:?} acked {} ack_result {}", + i, + i.acked, + i.ack_result + ); if i.acked && i.ack_result == 0 && i.uuid == if_uuid { if let Some(x) = &dce_data.du16 { @@ -156,11 +149,9 @@ pub extern "C" fn rs_smb_tx_get_dce_iface(state: &mut SMBState, } #[no_mangle] -pub unsafe extern "C" fn rs_smb_tx_get_ntlmssp_user(tx: &mut SMBTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32) - -> u8 -{ +pub unsafe extern fn rs_smb_tx_get_ntlmssp_user( + tx: &mut SMBTransaction, buffer: *mut *const u8, buffer_len: *mut u32, +) -> u8 { if let Some(SMBTransactionTypeData::SESSIONSETUP(ref x)) = tx.type_data { if let Some(ref ntlmssp) = x.ntlmssp { *buffer = ntlmssp.user.as_ptr(); @@ -175,11 +166,9 @@ pub unsafe extern "C" fn rs_smb_tx_get_ntlmssp_user(tx: &mut SMBTransaction, } #[no_mangle] -pub unsafe extern "C" fn rs_smb_tx_get_ntlmssp_domain(tx: &mut SMBTransaction, - buffer: *mut *const u8, - buffer_len: *mut u32) - -> u8 -{ +pub unsafe extern fn rs_smb_tx_get_ntlmssp_domain( + tx: &mut SMBTransaction, buffer: *mut *const u8, buffer_len: *mut u32, +) -> u8 { if let Some(SMBTransactionTypeData::SESSIONSETUP(ref x)) = tx.type_data { if let Some(ref ntlmssp) = x.ntlmssp { *buffer = ntlmssp.domain.as_ptr(); diff --git a/rust/src/smb/files.rs b/rust/src/smb/files.rs index b290357428ee..c0b27688d295 100644 --- a/rust/src/smb/files.rs +++ b/rust/src/smb/files.rs @@ -15,10 +15,10 @@ * 02110-1301, USA. */ -use std; use crate::core::*; -use crate::filetracker::*; use crate::filecontainer::*; +use crate::filetracker::*; +use std; use crate::smb::smb::*; @@ -41,41 +41,42 @@ impl SMBTransactionFile { return Self { file_tracker: FileTransferTracker::new(), ..Default::default() - } + }; } pub fn update_file_flags(&mut self, flow_file_flags: u16) { - let dir_flag = if self.direction == Direction::ToServer { STREAM_TOSERVER } else { STREAM_TOCLIENT }; + let dir_flag = if self.direction == Direction::ToServer { + STREAM_TOSERVER + } else { + STREAM_TOCLIENT + }; self.file_tracker.file_flags = unsafe { FileFlowFlagsToFlags(flow_file_flags, dir_flag) }; } } /// little wrapper around the FileTransferTracker::new_chunk method -pub fn filetracker_newchunk(ft: &mut FileTransferTracker, name: &[u8], data: &[u8], - chunk_offset: u64, chunk_size: u32, is_last: bool, xid: &u32) -{ +pub fn filetracker_newchunk( + ft: &mut FileTransferTracker, name: &[u8], data: &[u8], chunk_offset: u64, chunk_size: u32, + is_last: bool, xid: &u32, +) { if let Some(sfcm) = unsafe { SURICATA_SMB_FILE_CONFIG } { - ft.new_chunk(sfcm, name, data, chunk_offset, - chunk_size, 0, is_last, xid); + ft.new_chunk(sfcm, name, data, chunk_offset, chunk_size, 0, is_last, xid); } } -pub fn filetracker_trunc(ft: &mut FileTransferTracker) -{ +pub fn filetracker_trunc(ft: &mut FileTransferTracker) { if let Some(sfcm) = unsafe { SURICATA_SMB_FILE_CONFIG } { ft.trunc(sfcm); } } -pub fn filetracker_close(ft: &mut FileTransferTracker) -{ +pub fn filetracker_close(ft: &mut FileTransferTracker) { if let Some(sfcm) = unsafe { SURICATA_SMB_FILE_CONFIG } { ft.close(sfcm); } } -fn filetracker_update(ft: &mut FileTransferTracker, data: &[u8], gap_size: u32) -> u32 -{ +fn filetracker_update(ft: &mut FileTransferTracker, data: &[u8], gap_size: u32) -> u32 { if let Some(sfcm) = unsafe { SURICATA_SMB_FILE_CONFIG } { ft.update(sfcm, data, gap_size) } else { @@ -84,9 +85,9 @@ fn filetracker_update(ft: &mut FileTransferTracker, data: &[u8], gap_size: u32) } impl SMBState { - pub fn new_file_tx(&mut self, fuid: &[u8], file_name: &[u8], direction: Direction) - -> &mut SMBTransaction - { + pub fn new_file_tx( + &mut self, fuid: &[u8], file_name: &[u8], direction: Direction, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.type_data = Some(SMBTransactionTypeData::FILE(SMBTransactionFile::new())); if let Some(SMBTransactionTypeData::FILE(ref mut d)) = tx.type_data { @@ -98,9 +99,16 @@ impl SMBState { d.update_file_flags(tx.tx_data.file_flags); } tx.tx_data.init_files_opened(); - tx.tx_data.file_tx = if direction == Direction::ToServer { STREAM_TOSERVER } else { STREAM_TOCLIENT }; // TODO direction to flag func? - SCLogDebug!("SMB: new_file_tx: TX FILE created: ID {} NAME {}", - tx.id, String::from_utf8_lossy(file_name)); + tx.tx_data.file_tx = if direction == Direction::ToServer { + STREAM_TOSERVER + } else { + STREAM_TOCLIENT + }; // TODO direction to flag func? + SCLogDebug!( + "SMB: new_file_tx: TX FILE created: ID {} NAME {}", + tx.id, + String::from_utf8_lossy(file_name) + ); self.transactions.push_back(tx); let tx_ref = self.transactions.back_mut(); return tx_ref.unwrap(); @@ -108,16 +116,16 @@ impl SMBState { /// get file tx for a open file. Returns None if a file for the fuid exists, /// but has already been closed. - pub fn get_file_tx_by_fuid_with_open_file(&mut self, fuid: &[u8], direction: Direction) - -> Option<&mut SMBTransaction> - { + pub fn get_file_tx_by_fuid_with_open_file( + &mut self, fuid: &[u8], direction: Direction, + ) -> Option<&mut SMBTransaction> { let f = fuid.to_vec(); for tx in &mut self.transactions { let found = match tx.type_data { Some(SMBTransactionTypeData::FILE(ref mut d)) => { direction == d.direction && f == d.fuid && !d.file_tracker.is_done() - }, - _ => { false }, + } + _ => false, }; if found { @@ -134,16 +142,16 @@ impl SMBState { } /// get file tx for a fuid. File may already have been closed. - pub fn get_file_tx_by_fuid(&mut self, fuid: &[u8], direction: Direction) - -> Option<&mut SMBTransaction> - { + pub fn get_file_tx_by_fuid( + &mut self, fuid: &[u8], direction: Direction, + ) -> Option<&mut SMBTransaction> { let f = fuid.to_vec(); for tx in &mut self.transactions { let found = match tx.type_data { Some(SMBTransactionTypeData::FILE(ref mut d)) => { direction == d.direction && f == d.fuid - }, - _ => { false }, + } + _ => false, }; if found { @@ -168,7 +176,7 @@ impl SMBState { self.file_tc_left }; if chunk_left == 0 { - return 0 + return 0; } SCLogDebug!("chunk_left {} data {}", chunk_left, data.len()); let file_handle = if direction == Direction::ToServer { @@ -202,8 +210,12 @@ impl SMBState { if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { if ssn_gap { let queued_data = tdf.file_tracker.get_queued_size(); - if queued_data > 2000000 { // TODO should probably be configurable - SCLogDebug!("QUEUED size {} while we've seen GAPs. Truncating file.", queued_data); + if queued_data > 2000000 { + // TODO should probably be configurable + SCLogDebug!( + "QUEUED size {} while we've seen GAPs. Truncating file.", + queued_data + ); filetracker_trunc(&mut tdf.file_tracker); } } @@ -218,10 +230,11 @@ impl SMBState { } else { 0 } - }, + } None => { SCLogDebug!("not found for handle {:?}", file_handle); - 0 }, + 0 + } }; return consumed; @@ -230,13 +243,18 @@ impl SMBState { use crate::applayer::AppLayerGetFileState; #[no_mangle] -pub unsafe extern "C" fn rs_smb_gettxfiles(_state: *mut std::ffi::c_void, tx: *mut std::ffi::c_void, direction: u8) -> AppLayerGetFileState { +pub unsafe extern fn rs_smb_gettxfiles( + _state: *mut std::ffi::c_void, tx: *mut std::ffi::c_void, direction: u8, +) -> AppLayerGetFileState { let tx = cast_pointer!(tx, SMBTransaction); if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let tx_dir : u8 = tdf.direction.into(); + let tx_dir: u8 = tdf.direction.into(); if direction & tx_dir != 0 { if let Some(sfcm) = { SURICATA_SMB_FILE_CONFIG } { - return AppLayerGetFileState { fc: &mut tdf.file_tracker.file, cfg: sfcm.files_sbcfg } + return AppLayerGetFileState { + fc: &mut tdf.file_tracker.file, + cfg: sfcm.files_sbcfg, + }; } } } diff --git a/rust/src/smb/funcs.rs b/rust/src/smb/funcs.rs index afab69d967b9..43410418beb8 100644 --- a/rust/src/smb/funcs.rs +++ b/rust/src/smb/funcs.rs @@ -23,7 +23,7 @@ pub fn fsctl_func_to_string(f: u32) -> String { 0x00060194 => "FSCTL_DFS_GET_REFERRALS", 0x000601B0 => "FSCTL_DFS_GET_REFERRALS_EX", 0x00090000 => "FSCTL_REQUEST_OPLOCK_LEVEL_1", - 0x00090004 => "FSCTL_REQUEST_OPLOCK_LEVEL_2", + 0x00090004 => "FSCTL_REQUEST_OPLOCK_LEVEL_2", 0x00090008 => "FSCTL_REQUEST_BATCH_OPLOCK", 0x0009000C => "FSCTL_OPLOCK_BREAK_ACKNOWLEDGE", 0x00090010 => "FSCTL_OPBATCH_ACK_CLOSE_PENDING", @@ -38,7 +38,7 @@ pub fn fsctl_func_to_string(f: u32) -> String { 0x0009003C => "FSCTL_GET_COMPRESSION", 0x0009004F => "FSCTL_MARK_AS_SYSTEM_HIVE", 0x00090050 => "FSCTL_OPLOCK_BREAK_ACK_NO_2", - 0x00090054 => "FSCTL_INVALIDATE_VOLUMES", + 0x00090054 => "FSCTL_INVALIDATE_VOLUMES", 0x00090058 => "FSCTL_QUERY_FAT_BPB", 0x0009005C => "FSCTL_REQUEST_FILTER_OPLOCK", 0x00090060 => "FSCTL_FILESYSTEM_GET_STATISTICS", @@ -48,7 +48,7 @@ pub fn fsctl_func_to_string(f: u32) -> String { 0x00090073 => "FSCTL_GET_RETRIEVAL_POINTERS", 0x00090074 => "FSCTL_MOVE_FILE", 0x00090078 => "FSCTL_IS_VOLUME_DIRTY", - 0x0009007C => "FSCTL_GET_HFS_INFORMATION", + 0x0009007C => "FSCTL_GET_HFS_INFORMATION", 0x00090083 => "FSCTL_ALLOW_EXTENDED_DASD_IO", 0x00090087 => "FSCTL_READ_PROPERTY_DATA", 0x0009008B => "FSCTL_WRITE_PROPERTY_DATA", @@ -109,6 +109,9 @@ pub fn fsctl_func_to_string(f: u32) -> String { 0x001440F2 => "FSCTL_SRV_COPYCHUNK", 0x001441bb => "FSCTL_SRV_READ_HASH", 0x001480F2 => "FSCTL_SRV_COPYCHUNK_WRITE", - _ => { return (f).to_string(); }, - }.to_string() + _ => { + return (f).to_string(); + } + } + .to_string() } diff --git a/rust/src/smb/log.rs b/rust/src/smb/log.rs index 84965749ba17..b2cc7f6c1970 100644 --- a/rust/src/smb/log.rs +++ b/rust/src/smb/log.rs @@ -15,19 +15,21 @@ * 02110-1301, USA. */ -use std::str; -use std::string::String; -use uuid; +use crate::dcerpc::dcerpc::*; use crate::jsonbuilder::{JsonBuilder, JsonError}; +use crate::smb::funcs::*; use crate::smb::smb::*; use crate::smb::smb1::*; use crate::smb::smb2::*; -use crate::dcerpc::dcerpc::*; -use crate::smb::funcs::*; use crate::smb::smb_status::*; +use std::str; +use std::string::String; +use uuid; #[cfg(not(feature = "debug"))] -fn debug_add_progress(_js: &mut JsonBuilder, _tx: &SMBTransaction) -> Result<(), JsonError> { Ok(()) } +fn debug_add_progress(_js: &mut JsonBuilder, _tx: &SMBTransaction) -> Result<(), JsonError> { + Ok(()) +} #[cfg(feature = "debug")] fn debug_add_progress(jsb: &mut JsonBuilder, tx: &SMBTransaction) -> Result<(), JsonError> { @@ -65,8 +67,9 @@ fn guid_to_string(guid: &Vec) -> String { } } -fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransaction) -> Result<(), JsonError> -{ +fn smb_common_header( + jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransaction, +) -> Result<(), JsonError> { jsb.set_uint("id", tx.id)?; if state.dialect != 0 { @@ -75,7 +78,7 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio } else { let dialect = match state.dialect_vec { Some(ref d) => str::from_utf8(d).unwrap_or("invalid"), - None => "unknown", + None => "unknown", }; jsb.set_string("dialect", dialect)?; } @@ -86,14 +89,14 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio if ok { jsb.set_string("command", &smb1_command_string(cmd))?; } - }, + } 2 => { let (ok, cmd) = tx.vercmd.get_smb2_cmd(); if ok { jsb.set_string("command", &smb2_command_string(cmd))?; } - }, - _ => { }, + } + _ => {} } match tx.vercmd.get_ntstatus() { @@ -104,39 +107,39 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio None => { let status_str = format!("{}", ntstatus); jsb.set_string("status", &status_str)? - }, + } }; let status_hex = format!("0x{:x}", ntstatus); jsb.set_string("status_code", &status_hex)?; - }, + } (false, _) => { #[allow(clippy::single_match)] match tx.vercmd.get_dos_error() { (true, errclass, errcode) => { match errclass { - 1 => { // DOSERR + 1 => { + // DOSERR let status = smb_dos_error_string(errcode); jsb.set_string("status", &status)?; - }, - 2 => { // SRVERR + } + 2 => { + // SRVERR let status = smb_srv_error_string(errcode); jsb.set_string("status", &status)?; } _ => { let s = format!("UNKNOWN_{:02x}_{:04x}", errclass, errcode); jsb.set_string("status", &s)?; - }, + } } let status_hex = format!("0x{:04x}", errcode); jsb.set_string("status_code", &status_hex)?; - }, - (_, _, _) => { - }, + } + (_, _, _) => {} } - }, + } } - jsb.set_uint("session_id", tx.hdr.ssn_id)?; jsb.set_uint("tree_id", tx.hdr.tree_id as u64)?; @@ -189,10 +192,10 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio jsb.set_string("native_lm", &lm)?; jsb.close()?; } - }, + } Some(SMBTransactionTypeData::CREATE(ref x)) => { let mut name_raw = x.filename.to_vec(); - name_raw.retain(|&i|i != 0x00); + name_raw.retain(|&i| i != 0x00); if !name_raw.is_empty() { let name = String::from_utf8_lossy(&name_raw); if x.directory { @@ -205,13 +208,27 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio jsb.set_string("filename", "")?; } match x.disposition { - 0 => { jsb.set_string("disposition", "FILE_SUPERSEDE")?; }, - 1 => { jsb.set_string("disposition", "FILE_OPEN")?; }, - 2 => { jsb.set_string("disposition", "FILE_CREATE")?; }, - 3 => { jsb.set_string("disposition", "FILE_OPEN_IF")?; }, - 4 => { jsb.set_string("disposition", "FILE_OVERWRITE")?; }, - 5 => { jsb.set_string("disposition", "FILE_OVERWRITE_IF")?; }, - _ => { jsb.set_string("disposition", "UNKNOWN")?; }, + 0 => { + jsb.set_string("disposition", "FILE_SUPERSEDE")?; + } + 1 => { + jsb.set_string("disposition", "FILE_OPEN")?; + } + 2 => { + jsb.set_string("disposition", "FILE_CREATE")?; + } + 3 => { + jsb.set_string("disposition", "FILE_OPEN_IF")?; + } + 4 => { + jsb.set_string("disposition", "FILE_OVERWRITE")?; + } + 5 => { + jsb.set_string("disposition", "FILE_OVERWRITE_IF")?; + } + _ => { + jsb.set_string("disposition", "UNKNOWN")?; + } } if x.delete_on_close { jsb.set_string("access", "delete on close")?; @@ -228,7 +245,7 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio let gs = fuid_to_string(&x.guid); jsb.set_string("fuid", &gs)?; - }, + } Some(SMBTransactionTypeData::NEGOTIATE(ref x)) => { if x.smb_ver == 1 { jsb.open_array("client_dialects")?; @@ -258,7 +275,7 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio if state.max_write_size > 0 { jsb.set_uint("max_write_size", state.max_write_size.into())?; } - }, + } Some(SMBTransactionTypeData::TREECONNECT(ref x)) => { let share_name = String::from_utf8_lossy(&x.share_name); if x.is_pipe { @@ -284,13 +301,21 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio // share type only for SMB2 } else { match x.share_type { - 1 => { jsb.set_string("share_type", "FILE")?; }, - 2 => { jsb.set_string("share_type", "PIPE")?; }, - 3 => { jsb.set_string("share_type", "PRINT")?; }, - _ => { jsb.set_string("share_type", "UNKNOWN")?; }, + 1 => { + jsb.set_string("share_type", "FILE")?; + } + 2 => { + jsb.set_string("share_type", "PIPE")?; + } + 3 => { + jsb.set_string("share_type", "PRINT")?; + } + _ => { + jsb.set_string("share_type", "UNKNOWN")?; + } } } - }, + } Some(SMBTransactionTypeData::FILE(ref x)) => { let file_name = String::from_utf8_lossy(&x.file_name); jsb.set_string("filename", &file_name)?; @@ -298,7 +323,7 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio jsb.set_string("share", &share_name)?; let gs = fuid_to_string(&x.fuid); jsb.set_string("fuid", &gs)?; - }, + } Some(SMBTransactionTypeData::RENAME(ref x)) => { if tx.vercmd.get_version() == 2 { jsb.open_object("set_info")?; @@ -315,7 +340,7 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio jsb.close()?; let gs = fuid_to_string(&x.fuid); jsb.set_string("fuid", &gs)?; - }, + } Some(SMBTransactionTypeData::DCERPC(ref x)) => { jsb.open_object("dcerpc")?; if x.req_set { @@ -350,7 +375,9 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio for i in ifaces { jsb.start_object()?; let ifstr = uuid::Uuid::from_slice(&i.uuid); - let ifstr = ifstr.map(|ifstr| ifstr.to_hyphenated().to_string()).unwrap(); + let ifstr = ifstr + .map(|ifstr| ifstr.to_hyphenated().to_string()) + .unwrap(); jsb.set_string("uuid", &ifstr)?; let vstr = format!("{}.{}", i.ver, i.ver_min); jsb.set_string("version", &vstr)?; @@ -359,18 +386,20 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio jsb.close()?; } } - }, + } DCERPC_TYPE_BIND => { if let Some(ref ifaces) = state.dcerpc_ifaces { jsb.open_array("interfaces")?; for i in ifaces { jsb.start_object()?; let ifstr = uuid::Uuid::from_slice(&i.uuid); - let ifstr = ifstr.map(|ifstr| ifstr.to_hyphenated().to_string()).unwrap(); + let ifstr = ifstr + .map(|ifstr| ifstr.to_hyphenated().to_string()) + .unwrap(); jsb.set_string("uuid", &ifstr)?; let vstr = format!("{}.{}", i.ver, i.ver_min); jsb.set_string("version", &vstr)?; - + if i.acked { jsb.set_uint("ack_result", i.ack_result as u64)?; jsb.set_uint("ack_reason", i.ack_reason as u64)?; @@ -379,8 +408,8 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio } jsb.close()?; } - }, - _ => {}, + } + _ => {} } } if x.res_set { @@ -391,9 +420,9 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio jsb.set_uint("frag_cnt", x.frag_cnt_tc as u64)?; jsb.set_uint("stub_data_size", x.stub_data_tc.len() as u64)?; jsb.close()?; - }, + } // we don't handle BINDACK w/o BIND - _ => {}, + _ => {} } } jsb.set_uint("call_id", x.call_id as u64)?; @@ -401,10 +430,10 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio } Some(SMBTransactionTypeData::IOCTL(ref x)) => { jsb.set_string("function", &fsctl_func_to_string(x.func))?; - }, + } Some(SMBTransactionTypeData::SETFILEPATHINFO(ref x)) => { let mut name_raw = x.filename.to_vec(); - name_raw.retain(|&i|i != 0x00); + name_raw.retain(|&i| i != 0x00); if !name_raw.is_empty() { let name = String::from_utf8_lossy(&name_raw); jsb.set_string("filename", &name)?; @@ -421,38 +450,40 @@ fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransactio match x.subcmd { 8 => { jsb.set_string("subcmd", "SET_FILE_INFO")?; - }, + } 6 => { jsb.set_string("subcmd", "SET_PATH_INFO")?; - }, - _ => { }, + } + _ => {} } #[allow(clippy::single_match)] match x.loi { - 1013 => { // Set Disposition Information + 1013 => { + // Set Disposition Information jsb.set_string("level_of_interest", "Set Disposition Information")?; - }, - _ => { }, + } + _ => {} } let gs = fuid_to_string(&x.fid); jsb.set_string("fuid", &gs)?; - }, - _ => { }, + } + _ => {} } return Ok(()); } #[no_mangle] -pub extern "C" fn rs_smb_log_json_request(jsb: &mut JsonBuilder, state: &mut SMBState, tx: &mut SMBTransaction) -> bool -{ +pub extern fn rs_smb_log_json_request( + jsb: &mut JsonBuilder, state: &mut SMBState, tx: &mut SMBTransaction, +) -> bool { smb_common_header(jsb, state, tx).is_ok() } #[no_mangle] -pub extern "C" fn rs_smb_log_json_response(jsb: &mut JsonBuilder, state: &mut SMBState, tx: &mut SMBTransaction) -> bool -{ +pub extern fn rs_smb_log_json_response( + jsb: &mut JsonBuilder, state: &mut SMBState, tx: &mut SMBTransaction, +) -> bool { smb_common_header(jsb, state, tx).is_ok() } - diff --git a/rust/src/smb/mod.rs b/rust/src/smb/mod.rs index 5b74f1ca4e02..399878aab84f 100644 --- a/rust/src/smb/mod.rs +++ b/rust/src/smb/mod.rs @@ -17,31 +17,31 @@ //! SMB application layer, detection, logger and parser module. +pub mod dcerpc_records; pub mod error; -pub mod smb_records; -pub mod smb_status; -pub mod smb1_records; -pub mod smb2_records; pub mod nbss_records; -pub mod dcerpc_records; pub mod ntlmssp_records; +pub mod smb1_records; +pub mod smb2_records; +pub mod smb_records; +pub mod smb_status; +pub mod auth; +pub mod dcerpc; +pub mod debug; +pub mod detect; +pub mod events; +pub mod files; +pub mod funcs; +pub mod log; +pub mod session; pub mod smb; pub mod smb1; pub mod smb1_session; pub mod smb2; -pub mod smb2_session; pub mod smb2_ioctl; +pub mod smb2_session; pub mod smb3; -pub mod dcerpc; -pub mod session; -pub mod log; -pub mod detect; -pub mod debug; -pub mod events; -pub mod auth; -pub mod files; -pub mod funcs; //#[cfg(feature = "lua")] //pub mod lua; diff --git a/rust/src/smb/nbss_records.rs b/rust/src/smb/nbss_records.rs index 6225eb47067e..87fd247ebb9f 100644 --- a/rust/src/smb/nbss_records.rs +++ b/rust/src/smb/nbss_records.rs @@ -20,29 +20,29 @@ use nom7::combinator::rest; use nom7::number::streaming::be_u32; use nom7::IResult; -pub const NBSS_MSGTYPE_SESSION_MESSAGE: u8 = 0x00; -pub const NBSS_MSGTYPE_SESSION_REQUEST: u8 = 0x81; -pub const NBSS_MSGTYPE_POSITIVE_SSN_RESPONSE: u8 = 0x82; -pub const NBSS_MSGTYPE_NEGATIVE_SSN_RESPONSE: u8 = 0x83; -pub const NBSS_MSGTYPE_RETARG_RESPONSE: u8 = 0x84; -pub const NBSS_MSGTYPE_KEEP_ALIVE: u8 = 0x85; - -#[derive(Debug,PartialEq, Eq)] +pub const NBSS_MSGTYPE_SESSION_MESSAGE: u8 = 0x00; +pub const NBSS_MSGTYPE_SESSION_REQUEST: u8 = 0x81; +pub const NBSS_MSGTYPE_POSITIVE_SSN_RESPONSE: u8 = 0x82; +pub const NBSS_MSGTYPE_NEGATIVE_SSN_RESPONSE: u8 = 0x83; +pub const NBSS_MSGTYPE_RETARG_RESPONSE: u8 = 0x84; +pub const NBSS_MSGTYPE_KEEP_ALIVE: u8 = 0x85; + +#[derive(Debug, PartialEq, Eq)] pub struct NbssRecord<'a> { pub message_type: u8, pub length: u32, - pub data: &'a[u8], + pub data: &'a [u8], } impl<'a> NbssRecord<'a> { pub fn is_valid(&self) -> bool { let valid = match self.message_type { - NBSS_MSGTYPE_SESSION_MESSAGE | - NBSS_MSGTYPE_SESSION_REQUEST | - NBSS_MSGTYPE_POSITIVE_SSN_RESPONSE | - NBSS_MSGTYPE_NEGATIVE_SSN_RESPONSE | - NBSS_MSGTYPE_RETARG_RESPONSE | - NBSS_MSGTYPE_KEEP_ALIVE => true, + NBSS_MSGTYPE_SESSION_MESSAGE + | NBSS_MSGTYPE_SESSION_REQUEST + | NBSS_MSGTYPE_POSITIVE_SSN_RESPONSE + | NBSS_MSGTYPE_NEGATIVE_SSN_RESPONSE + | NBSS_MSGTYPE_RETARG_RESPONSE + | NBSS_MSGTYPE_KEEP_ALIVE => true, _ => false, }; valid @@ -52,8 +52,11 @@ impl<'a> NbssRecord<'a> { } pub fn is_smb(&self) -> bool { let valid = self.is_valid(); - let smb = self.data.len() >= 4 && - self.data[1] == b'S' && self.data[2] == b'M' && self.data[3] == b'B' && (self.data[0] == b'\xFE' || self.data[0] == b'\xFF' || self.data[0] == b'\xFD'); + let smb = self.data.len() >= 4 + && self.data[1] == b'S' + && self.data[2] == b'M' + && self.data[3] == b'B' + && (self.data[0] == b'\xFE' || self.data[0] == b'\xFF' || self.data[0] == b'\xFD'); valid && smb } @@ -93,19 +96,15 @@ mod tests { #[test] fn test_parse_nbss_record() { - let buff:&[u8] = &[ - /* message type */ 0x00, - /* length */ 0x00, 0x00, 0x55, - /* data */ 0xff, 0x53, 0x4d, 0x42, 0x72, 0x00, 0x00, 0x00, 0x00, - 0x98, 0x53, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xfe, 0x00, 0x00, 0x00, 0x00, 0x11, 0x05, 0x00, 0x03, - 0x0a, 0x00, 0x01, 0x00, 0x04, 0x11, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xe3, - 0x00, 0x80, 0x2a, 0x55, 0xc4, 0x38, 0x89, 0x03, 0xcd, - 0x01, 0x2c, 0x01, 0x00, 0x10, 0x00, 0xfe, 0x82, 0xf1, - 0x64, 0x0b, 0x66, 0xba, 0x4a, 0xbb, 0x81, 0xe1, 0xea, - 0x54, 0xae, 0xb8, 0x66]; + let buff: &[u8] = &[ + /* message type */ 0x00, /* length */ 0x00, 0x00, 0x55, /* data */ 0xff, + 0x53, 0x4d, 0x42, 0x72, 0x00, 0x00, 0x00, 0x00, 0x98, 0x53, 0xc8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0x11, 0x05, 0x00, 0x03, 0x0a, 0x00, 0x01, 0x00, 0x04, 0x11, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xe3, 0x00, 0x80, 0x2a, + 0x55, 0xc4, 0x38, 0x89, 0x03, 0xcd, 0x01, 0x2c, 0x01, 0x00, 0x10, 0x00, 0xfe, 0x82, + 0xf1, 0x64, 0x0b, 0x66, 0xba, 0x4a, 0xbb, 0x81, 0xe1, 0xea, 0x54, 0xae, 0xb8, 0x66, + ]; let result = parse_nbss_record(buff); match result { @@ -136,19 +135,16 @@ mod tests { } // Non-SMB packet scenario - let buff_not_smb:&[u8] = &[ - /* message type */ 0x00, - /* length */ 0x00, 0x00, 0x55, - /* data !SMB */ 0xff, 0x52, 0x4e, 0x41, 0x72, 0x00, 0x00, 0x00, 0x00, - 0x98, 0x53, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xfe, 0x00, 0x00, 0x00, 0x00, 0x11, 0x05, 0x00, 0x03, - 0x0a, 0x00, 0x01, 0x00, 0x04, 0x11, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xe3, - 0x00, 0x80, 0x2a, 0x55, 0xc4, 0x38, 0x89, 0x03, 0xcd, - 0x01, 0x2c, 0x01, 0x00, 0x10, 0x00, 0xfe, 0x82, 0xf1, - 0x64, 0x0b, 0x66, 0xba, 0x4a, 0xbb, 0x81, 0xe1, 0xea, - 0x54, 0xae, 0xb8, 0x66]; + let buff_not_smb: &[u8] = &[ + /* message type */ 0x00, /* length */ 0x00, 0x00, 0x55, + /* data !SMB */ 0xff, 0x52, 0x4e, 0x41, 0x72, 0x00, 0x00, 0x00, 0x00, 0x98, 0x53, + 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x11, 0x05, 0x00, 0x03, 0x0a, 0x00, 0x01, + 0x00, 0x04, 0x11, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, + 0xe3, 0x00, 0x80, 0x2a, 0x55, 0xc4, 0x38, 0x89, 0x03, 0xcd, 0x01, 0x2c, 0x01, 0x00, + 0x10, 0x00, 0xfe, 0x82, 0xf1, 0x64, 0x0b, 0x66, 0xba, 0x4a, 0xbb, 0x81, 0xe1, 0xea, + 0x54, 0xae, 0xb8, 0x66, + ]; let result_not_smb = parse_nbss_record(buff_not_smb); match result_not_smb { @@ -182,14 +178,13 @@ mod tests { #[test] fn test_parse_nbss_record_partial() { - let buff:&[u8] = &[ - /* message type */ 0x00, - /* length */ 0x00, 0x00, 0x29, - /* data < length*/ 0xff, 0x53, 0x4d, 0x42, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x43, 0xc8, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x08, 0xbd, 0x20, 0x02, 0x08, 0x06, 0x00, - 0x02, 0x40, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00]; + let buff: &[u8] = &[ + /* message type */ 0x00, /* length */ 0x00, 0x00, 0x29, + /* data < length*/ 0xff, 0x53, 0x4d, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x43, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x08, 0xbd, 0x20, 0x02, 0x08, 0x06, 0x00, 0x02, 0x40, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, + ]; let result = parse_nbss_record_partial(buff); match result { @@ -218,6 +213,5 @@ mod tests { panic!("Unexpected behavior!"); } } - } } diff --git a/rust/src/smb/session.rs b/rust/src/smb/session.rs index be7866976dc9..069cdf6be334 100644 --- a/rust/src/smb/session.rs +++ b/rust/src/smb/session.rs @@ -16,9 +16,9 @@ */ use crate::kerberos::*; +use crate::smb::auth::*; use crate::smb::smb::*; use crate::smb::smb1_session::*; -use crate::smb::auth::*; #[derive(Default, Debug)] pub struct SMBTransactionSessionSetup { @@ -30,19 +30,18 @@ pub struct SMBTransactionSessionSetup { impl SMBTransactionSessionSetup { pub fn new() -> Self { - return Default::default() + return Default::default(); } } impl SMBState { - pub fn new_sessionsetup_tx(&mut self, hdr: SMBCommonHdr) - -> &mut SMBTransaction - { + pub fn new_sessionsetup_tx(&mut self, hdr: SMBCommonHdr) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.hdr = hdr; tx.type_data = Some(SMBTransactionTypeData::SESSIONSETUP( - SMBTransactionSessionSetup::new())); + SMBTransactionSessionSetup::new(), + )); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated @@ -52,14 +51,13 @@ impl SMBState { return tx_ref.unwrap(); } - pub fn get_sessionsetup_tx(&mut self, hdr: SMBCommonHdr) - -> Option<&mut SMBTransaction> - { + pub fn get_sessionsetup_tx(&mut self, hdr: SMBCommonHdr) -> Option<&mut SMBTransaction> { for tx in &mut self.transactions { - let hit = tx.hdr.compare(&hdr) && match tx.type_data { - Some(SMBTransactionTypeData::SESSIONSETUP(_)) => { true }, - _ => { false }, - }; + let hit = tx.hdr.compare(&hdr) + && match tx.type_data { + Some(SMBTransactionTypeData::SESSIONSETUP(_)) => true, + _ => false, + }; if hit { return Some(tx); } diff --git a/rust/src/smb/smb.rs b/rust/src/smb/smb.rs index d6b0a565c060..6362eb79b695 100644 --- a/rust/src/smb/smb.rs +++ b/rust/src/smb/smb.rs @@ -26,34 +26,34 @@ // written by Victor Julien use std; -use std::str; use std::ffi::{self, CString}; +use std::str; use std::collections::HashMap; use std::collections::VecDeque; - -use nom7::{Err, Needed}; + use nom7::error::{make_error, ErrorKind}; +use nom7::{Err, Needed}; -use crate::core::*; use crate::applayer; use crate::applayer::*; -use crate::frames::*; +use crate::applayer::{AppLayerEvent, AppLayerResult, AppLayerTxData}; use crate::conf::*; -use crate::applayer::{AppLayerResult, AppLayerTxData, AppLayerEvent}; +use crate::core::*; +use crate::frames::*; use crate::smb::nbss_records::*; use crate::smb::smb1_records::*; use crate::smb::smb2_records::*; -use crate::smb::smb1::*; -use crate::smb::smb2::*; -use crate::smb::smb3::*; use crate::smb::dcerpc::*; -use crate::smb::session::*; use crate::smb::events::*; use crate::smb::files::*; +use crate::smb::session::*; +use crate::smb::smb1::*; +use crate::smb::smb2::*; use crate::smb::smb2_ioctl::*; +use crate::smb::smb3::*; #[derive(AppLayerFrameType)] pub enum SMBFrameType { @@ -88,62 +88,70 @@ static mut SMB_MAX_TX: usize = 1024; pub static mut SURICATA_SMB_FILE_CONFIG: Option<&'static SuricataFileContext> = None; #[no_mangle] -pub extern "C" fn rs_smb_init(context: &'static mut SuricataFileContext) -{ +pub extern fn rs_smb_init(context: &'static mut SuricataFileContext) { unsafe { SURICATA_SMB_FILE_CONFIG = Some(context); } } -pub const SMB_SRV_ERROR: u16 = 1; -pub const SMB_SRV_BADPW: u16 = 2; -pub const SMB_SRV_BADTYPE: u16 = 3; -pub const SMB_SRV_ACCESS: u16 = 4; -pub const SMB_SRV_BADUID: u16 = 91; +pub const SMB_SRV_ERROR: u16 = 1; +pub const SMB_SRV_BADPW: u16 = 2; +pub const SMB_SRV_BADTYPE: u16 = 3; +pub const SMB_SRV_ACCESS: u16 = 4; +pub const SMB_SRV_BADUID: u16 = 91; pub fn smb_srv_error_string(c: u16) -> String { match c { - SMB_SRV_ERROR => "SRV_ERROR", - SMB_SRV_BADPW => "SRV_BADPW", - SMB_SRV_BADTYPE => "SRV_BADTYPE", - SMB_SRV_ACCESS => "SRV_ACCESS", - SMB_SRV_BADUID => "SRV_BADUID", - _ => { return (c).to_string(); }, - }.to_string() + SMB_SRV_ERROR => "SRV_ERROR", + SMB_SRV_BADPW => "SRV_BADPW", + SMB_SRV_BADTYPE => "SRV_BADTYPE", + SMB_SRV_ACCESS => "SRV_ACCESS", + SMB_SRV_BADUID => "SRV_BADUID", + _ => { + return (c).to_string(); + } + } + .to_string() } -pub const SMB_DOS_SUCCESS: u16 = 0; -pub const SMB_DOS_BAD_FUNC: u16 = 1; -pub const SMB_DOS_BAD_FILE: u16 = 2; -pub const SMB_DOS_BAD_PATH: u16 = 3; -pub const SMB_DOS_TOO_MANY_OPEN_FILES: u16 = 4; -pub const SMB_DOS_ACCESS_DENIED: u16 = 5; +pub const SMB_DOS_SUCCESS: u16 = 0; +pub const SMB_DOS_BAD_FUNC: u16 = 1; +pub const SMB_DOS_BAD_FILE: u16 = 2; +pub const SMB_DOS_BAD_PATH: u16 = 3; +pub const SMB_DOS_TOO_MANY_OPEN_FILES: u16 = 4; +pub const SMB_DOS_ACCESS_DENIED: u16 = 5; pub fn smb_dos_error_string(c: u16) -> String { match c { - SMB_DOS_SUCCESS => "DOS_SUCCESS", - SMB_DOS_BAD_FUNC => "DOS_BAD_FUNC", - SMB_DOS_BAD_FILE => "DOS_BAD_FILE", - SMB_DOS_BAD_PATH => "DOS_BAD_PATH", + SMB_DOS_SUCCESS => "DOS_SUCCESS", + SMB_DOS_BAD_FUNC => "DOS_BAD_FUNC", + SMB_DOS_BAD_FILE => "DOS_BAD_FILE", + SMB_DOS_BAD_PATH => "DOS_BAD_PATH", SMB_DOS_TOO_MANY_OPEN_FILES => "DOS_TOO_MANY_OPEN_FILES", - SMB_DOS_ACCESS_DENIED => "DOS_ACCESS_DENIED", - _ => { return (c).to_string(); }, - }.to_string() + SMB_DOS_ACCESS_DENIED => "DOS_ACCESS_DENIED", + _ => { + return (c).to_string(); + } + } + .to_string() } -pub const NTLMSSP_NEGOTIATE: u32 = 1; +pub const NTLMSSP_NEGOTIATE: u32 = 1; #[cfg(feature = "debug")] -pub const NTLMSSP_CHALLENGE: u32 = 2; -pub const NTLMSSP_AUTH: u32 = 3; +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", - NTLMSSP_CHALLENGE => "NTLMSSP_CHALLENGE", - NTLMSSP_AUTH => "NTLMSSP_AUTH", - _ => { return (c).to_string(); }, - }.to_string() + NTLMSSP_NEGOTIATE => "NTLMSSP_NEGOTIATE", + NTLMSSP_CHALLENGE => "NTLMSSP_CHALLENGE", + NTLMSSP_AUTH => "NTLMSSP_AUTH", + _ => { + return (c).to_string(); + } + } + .to_string() } #[derive(Default, Eq, PartialEq, Debug, Clone)] @@ -167,7 +175,7 @@ impl SMBVerCmdStat { smb_ver: 1, smb1_cmd: cmd, ..Default::default() - } + }; } pub fn new1_with_ntstatus(cmd: u8, status: u32) -> Self { return Self { @@ -176,14 +184,14 @@ impl SMBVerCmdStat { status_set: true, status, ..Default::default() - } + }; } pub fn new2(cmd: u16) -> Self { return Self { smb_ver: 2, smb2_cmd: cmd, ..Default::default() - } + }; } pub fn new2_with_ntstatus(cmd: u16, status: u32) -> Self { @@ -193,7 +201,7 @@ impl SMBVerCmdStat { status_set: true, status, ..Default::default() - } + }; } pub fn set_smb1_cmd(&mut self, cmd: u8) -> bool { @@ -237,11 +245,14 @@ impl SMBVerCmdStat { } pub fn get_dos_error(&self) -> (bool, u8, u16) { - (self.status_set && self.status_is_dos_error, self.status_error_class, self.status as u16) + ( + self.status_set && self.status_is_dos_error, + self.status_error_class, + self.status as u16, + ) } - fn set_status(&mut self, status: u32, is_dos_error: bool) - { + fn set_status(&mut self, status: u32, is_dos_error: bool) { if is_dos_error { self.status_is_dos_error = true; self.status_error_class = (status & 0x0000_00ff) as u8; @@ -252,13 +263,11 @@ impl SMBVerCmdStat { self.status_set = true; } - pub fn set_ntstatus(&mut self, status: u32) - { + pub fn set_ntstatus(&mut self, status: u32) { self.set_status(status, false) } - pub fn set_status_dos_error(&mut self, status: u32) - { + pub fn set_status_dos_error(&mut self, status: u32) { self.set_status(status, true) } } @@ -268,14 +277,12 @@ impl SMBVerCmdStat { /// Coordinated Universal Time (UTC)." #[derive(Eq, PartialEq, Debug, Clone)] pub struct SMBFiletime { - ts: u64, + ts: u64, } impl SMBFiletime { pub fn new(raw: u64) -> Self { - Self { - ts: raw, - } + Self { ts: raw } } /// inspired by Bro, convert FILETIME to secs since unix epoch @@ -313,11 +320,12 @@ pub struct SMBTransactionSetFilePathInfo { } impl SMBTransactionSetFilePathInfo { - pub fn new(filename: Vec, fid: Vec, subcmd: u16, loi: u16, delete_on_close: bool) - -> Self - { + pub fn new( + filename: Vec, fid: Vec, subcmd: u16, loi: u16, delete_on_close: bool, + ) -> Self { return Self { - filename, fid, + filename, + fid, subcmd, loi, delete_on_close, @@ -326,15 +334,14 @@ impl SMBTransactionSetFilePathInfo { } impl SMBState { - pub fn new_setfileinfo_tx(&mut self, filename: Vec, fid: Vec, - subcmd: u16, loi: u16, delete_on_close: bool) - -> &mut SMBTransaction - { + pub fn new_setfileinfo_tx( + &mut self, filename: Vec, fid: Vec, subcmd: u16, loi: u16, delete_on_close: bool, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.type_data = Some(SMBTransactionTypeData::SETFILEPATHINFO( - SMBTransactionSetFilePathInfo::new( - filename, fid, subcmd, loi, delete_on_close))); + SMBTransactionSetFilePathInfo::new(filename, fid, subcmd, loi, delete_on_close), + )); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated @@ -344,16 +351,15 @@ impl SMBState { return tx_ref.unwrap(); } - pub fn new_setpathinfo_tx(&mut self, filename: Vec, - subcmd: u16, loi: u16, delete_on_close: bool) - -> &mut SMBTransaction - { + pub fn new_setpathinfo_tx( + &mut self, filename: Vec, subcmd: u16, loi: u16, delete_on_close: bool, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); - let fid : Vec = Vec::new(); + let fid: Vec = Vec::new(); tx.type_data = Some(SMBTransactionTypeData::SETFILEPATHINFO( - SMBTransactionSetFilePathInfo::new(filename, fid, - subcmd, loi, delete_on_close))); + SMBTransactionSetFilePathInfo::new(filename, fid, subcmd, loi, delete_on_close), + )); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated @@ -374,19 +380,22 @@ pub struct SMBTransactionRename { impl SMBTransactionRename { pub fn new(fuid: Vec, oldname: Vec, newname: Vec) -> Self { return Self { - fuid, oldname, newname, + fuid, + oldname, + newname, }; } } impl SMBState { - pub fn new_rename_tx(&mut self, fuid: Vec, oldname: Vec, newname: Vec) - -> &mut SMBTransaction - { + pub fn new_rename_tx( + &mut self, fuid: Vec, oldname: Vec, newname: Vec, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); - tx.type_data = Some(SMBTransactionTypeData::RENAME( - SMBTransactionRename::new(fuid, oldname, newname))); + tx.type_data = Some(SMBTransactionTypeData::RENAME(SMBTransactionRename::new( + fuid, oldname, newname, + ))); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated @@ -421,7 +430,7 @@ impl SMBTransactionCreate { directory: dir, filename, ..Default::default() - } + }; } } @@ -469,7 +478,8 @@ impl SMBTransactionTreeConnect { #[derive(Debug)] pub struct SMBTransaction { - pub id: u64, /// internal id + pub id: u64, + /// internal id /// version, command and status pub vercmd: SMBVerCmdStat, @@ -502,18 +512,17 @@ impl Default for SMBTransaction { impl SMBTransaction { pub fn new() -> Self { return Self { - id: 0, - vercmd: SMBVerCmdStat::new(), - hdr: SMBCommonHdr::default(), - request_done: false, - response_done: false, - type_data: None, - tx_data: AppLayerTxData::new(), - } + id: 0, + vercmd: SMBVerCmdStat::new(), + hdr: SMBCommonHdr::default(), + request_done: false, + response_done: false, + type_data: None, + tx_data: AppLayerTxData::new(), + }; } - pub fn set_status(&mut self, status: u32, is_dos_error: bool) - { + pub fn set_status(&mut self, status: u32, is_dos_error: bool) { if is_dos_error { self.vercmd.set_status_dos_error(status); } else { @@ -547,25 +556,22 @@ pub struct SMBFileGUIDOffset { impl SMBFileGUIDOffset { pub fn new(guid: Vec, offset: u64) -> Self { - Self { - guid, - offset, - } + Self { guid, offset } } } /// type values to make sure we're not mixing things /// up in hashmap lookups -pub const SMBHDR_TYPE_GUID: u32 = 1; -pub const SMBHDR_TYPE_SHARE: u32 = 2; -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_GUID: u32 = 1; +pub const SMBHDR_TYPE_SHARE: u32 = 2; +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; //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; +pub const SMBHDR_TYPE_TRANS_FRAG: u32 = 8; +pub const SMBHDR_TYPE_TREE: u32 = 9; +pub const SMBHDR_TYPE_DCERPCTX: u32 = 10; #[derive(Default, Hash, Eq, PartialEq, Debug)] pub struct SMBCommonHdr { @@ -586,21 +592,20 @@ impl SMBCommonHdr { } pub fn from2(r: &Smb2Record, rec_type: u32) -> SMBCommonHdr { let tree_id = match rec_type { - SMBHDR_TYPE_TREE => { 0 }, + SMBHDR_TYPE_TREE => 0, _ => r.tree_id, }; let msg_id = match rec_type { - SMBHDR_TYPE_TRANS_FRAG | SMBHDR_TYPE_SHARE => { 0 }, - _ => { r.message_id }, + SMBHDR_TYPE_TRANS_FRAG | SMBHDR_TYPE_SHARE => 0, + _ => r.message_id, }; SMBCommonHdr { rec_type, - ssn_id : r.session_id, + ssn_id: r.session_id, tree_id, msg_id, } - } pub fn from2_notree(r: &Smb2Record, rec_type: u32) -> SMBCommonHdr { // async responses do not have a tree id (even if the request has it) @@ -609,30 +614,30 @@ impl SMBCommonHdr { // across all messages that are sent on the same SMB2 Protocol transport connection. // cf https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/ea4560b7-90da-4803-82b5-344754b92a79 let msg_id = match rec_type { - SMBHDR_TYPE_TRANS_FRAG | SMBHDR_TYPE_SHARE => { 0 }, - _ => { r.message_id }, + SMBHDR_TYPE_TRANS_FRAG | SMBHDR_TYPE_SHARE => 0, + _ => r.message_id, }; SMBCommonHdr { rec_type, - ssn_id : r.session_id, - tree_id : 0, + ssn_id: r.session_id, + tree_id: 0, msg_id, } } pub fn from1(r: &SmbRecord, rec_type: u32) -> SMBCommonHdr { let tree_id = match rec_type { - SMBHDR_TYPE_TREE => { 0 }, + SMBHDR_TYPE_TREE => 0, _ => r.tree_id as u32, }; let msg_id = match rec_type { - SMBHDR_TYPE_TRANS_FRAG | SMBHDR_TYPE_SHARE => { 0 }, - _ => { r.multiplex_id as u64 }, + SMBHDR_TYPE_TRANS_FRAG | SMBHDR_TYPE_SHARE => 0, + _ => r.multiplex_id as u64, }; SMBCommonHdr { rec_type, - ssn_id : r.ssn_id as u64, + ssn_id: r.ssn_id as u64, tree_id, msg_id, } @@ -640,8 +645,7 @@ impl SMBCommonHdr { // don't include tree id pub fn compare(&self, hdr: &SMBCommonHdr) -> bool { - self.rec_type == hdr.rec_type && self.ssn_id == hdr.ssn_id && - self.msg_id == hdr.msg_id + self.rec_type == hdr.rec_type && self.ssn_id == hdr.ssn_id && self.msg_id == hdr.msg_id } } @@ -653,9 +657,7 @@ pub struct SMBHashKeyHdrGuid { impl SMBHashKeyHdrGuid { pub fn new(hdr: SMBCommonHdr, guid: Vec) -> Self { - Self { - hdr, guid, - } + Self { hdr, guid } } } @@ -667,23 +669,20 @@ pub struct SMBTree { impl SMBTree { pub fn new(name: Vec, is_pipe: bool) -> Self { - Self { - name, - is_pipe, - } + Self { name, is_pipe } } } -pub fn u32_as_bytes(i: u32) -> [u8;4] { +pub fn u32_as_bytes(i: u32) -> [u8; 4] { let o1: u8 = ((i >> 24) & 0xff) as u8; let o2: u8 = ((i >> 16) & 0xff) as u8; - let o3: u8 = ((i >> 8) & 0xff) as u8; - let o4: u8 = (i & 0xff) as u8; - return [o1, o2, o3, o4] + let o3: u8 = ((i >> 8) & 0xff) as u8; + let o4: u8 = (i & 0xff) as u8; + return [o1, o2, o3, o4]; } #[derive(Default, Debug)] -pub struct SMBState<> { +pub struct SMBState { pub state_data: AppLayerStateData, /// map ssn/tree/msgid to vec (guid/name/share) @@ -702,10 +701,10 @@ pub struct SMBState<> { skip_ts: u32, skip_tc: u32, - pub file_ts_left : u32, - pub file_tc_left : u32, - pub file_ts_guid : Vec, - pub file_tc_guid : Vec, + pub file_ts_left: u32, + pub file_tc_left: u32, + pub file_ts_guid: Vec, + pub file_tc_guid: Vec, pub ts_ssn_gap: bool, pub tc_ssn_gap: bool, @@ -759,18 +758,18 @@ impl SMBState { /// Allocation function for a new TLS parser instance pub fn new() -> Self { Self { - state_data:AppLayerStateData::new(), - ssn2vec_map:HashMap::new(), - guid2name_map:HashMap::new(), - ssn2vecoffset_map:HashMap::new(), - ssn2tree_map:HashMap::new(), - ssnguid2vec_map:HashMap::new(), - skip_ts:0, - skip_tc:0, - file_ts_left:0, - file_tc_left:0, - file_ts_guid:Vec::new(), - file_tc_guid:Vec::new(), + state_data: AppLayerStateData::new(), + ssn2vec_map: HashMap::new(), + guid2name_map: HashMap::new(), + ssn2vecoffset_map: HashMap::new(), + ssn2tree_map: HashMap::new(), + ssnguid2vec_map: HashMap::new(), + skip_ts: 0, + skip_tc: 0, + file_ts_left: 0, + file_tc_left: 0, + file_ts_guid: Vec::new(), + file_tc_guid: Vec::new(), ts_ssn_gap: false, tc_ssn_gap: false, ts_gap: false, @@ -781,8 +780,8 @@ impl SMBState { post_gap_files_checked: false, transactions: VecDeque::new(), tx_index_completed: 0, - tx_id:0, - dialect:0, + tx_id: 0, + dialect: 0, dialect_vec: None, dcerpc_ifaces: None, ts: 0, @@ -812,13 +811,12 @@ impl SMBState { } } self.tx_index_completed = index; - } return tx; } pub fn free_tx(&mut self, tx_id: u64) { - SCLogDebug!("Freeing TX with ID {} TX.ID {}", tx_id, tx_id+1); + SCLogDebug!("Freeing TX with ID {} TX.ID {}", tx_id, tx_id + 1); let len = self.transactions.len(); let mut found = false; let mut index = 0; @@ -827,26 +825,37 @@ impl SMBState { if tx.id == tx_id + 1 { found = true; index = i; - SCLogDebug!("tx {} progress {}/{}", tx.id, tx.request_done, tx.response_done); + SCLogDebug!( + "tx {} progress {}/{}", + tx.id, + tx.request_done, + tx.response_done + ); break; } } if found { - SCLogDebug!("freeing TX with ID {} TX.ID {} at index {} left: {} max id: {}", - tx_id, tx_id+1, index, self.transactions.len(), self.tx_id); + SCLogDebug!( + "freeing TX with ID {} TX.ID {} at index {} left: {} max id: {}", + tx_id, + tx_id + 1, + index, + self.transactions.len(), + self.tx_id + ); self.tx_index_completed = 0; self.transactions.remove(index); } } pub fn get_tx_by_id(&mut self, tx_id: u64) -> Option<&SMBTransaction> { -/* - if self.transactions.len() > 100 { - SCLogNotice!("get_tx_by_id: tx_id={} in list={}", tx_id, self.transactions.len()); - self._dump_txs(); - panic!("txs exploded"); - } -*/ + /* + if self.transactions.len() > 100 { + SCLogNotice!("get_tx_by_id: tx_id={} in list={}", tx_id, self.transactions.len()); + self._dump_txs(); + panic!("txs exploded"); + } + */ for tx in &mut self.transactions { if tx.id == tx_id + 1 { let ver = tx.vercmd.get_version(); @@ -858,8 +867,15 @@ impl SMBState { let (_, cmd) = tx.vercmd.get_smb1_cmd(); _smbcmd = cmd as u16; } - SCLogDebug!("Found SMB TX: id {} ver:{} cmd:{} progress {}/{} type_data {:?}", - tx.id, ver, _smbcmd, tx.request_done, tx.response_done, tx.type_data); + SCLogDebug!( + "Found SMB TX: id {} ver:{} cmd:{} progress {}/{} type_data {:?}", + tx.id, + ver, + _smbcmd, + tx.request_done, + tx.response_done, + tx.type_data + ); /* hack: apply flow file flags to file tx here to make sure its propagated */ if let Some(SMBTransactionTypeData::FILE(ref mut d)) = tx.type_data { tx.tx_data.update_file_flags(self.state_data.file_flags); @@ -882,9 +898,9 @@ impl SMBState { /* generic TX has no type_data and is only used to * track a single cmd request/reply pair. */ - pub fn new_generic_tx(&mut self, smb_ver: u8, smb_cmd: u16, key: SMBCommonHdr) - -> &mut SMBTransaction - { + pub fn new_generic_tx( + &mut self, smb_ver: u8, smb_cmd: u16, key: SMBCommonHdr, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); if smb_ver == 1 && smb_cmd <= 255 { tx.vercmd.set_smb1_cmd(smb_cmd as u8); @@ -897,16 +913,18 @@ impl SMBState { tx.response_done = self.tc_trunc; // no response expected if tc is truncated tx.hdr = key; - SCLogDebug!("SMB: TX GENERIC created: ID {} tx list {} {:?}", - tx.id, self.transactions.len(), &tx); + SCLogDebug!( + "SMB: TX GENERIC created: ID {} tx list {} {:?}", + tx.id, + self.transactions.len(), + &tx + ); self.transactions.push_back(tx); let tx_ref = self.transactions.back_mut(); return tx_ref.unwrap(); } - pub fn get_last_tx(&mut self, smb_ver: u8, smb_cmd: u16) - -> Option<&mut SMBTransaction> - { + pub fn get_last_tx(&mut self, smb_ver: u8, smb_cmd: u16) -> Option<&mut SMBTransaction> { let tx_ref = self.transactions.back_mut(); if let Some(tx) = tx_ref { let found = if tx.vercmd.get_version() == smb_ver { @@ -929,9 +947,9 @@ impl SMBState { return None; } - pub fn get_generic_tx(&mut self, smb_ver: u8, smb_cmd: u16, key: &SMBCommonHdr) - -> Option<&mut SMBTransaction> - { + pub fn get_generic_tx( + &mut self, smb_ver: u8, smb_cmd: u16, key: &SMBCommonHdr, + ) -> Option<&mut SMBTransaction> { for tx in &mut self.transactions { let found = if tx.vercmd.get_version() == smb_ver { if smb_ver == 1 { @@ -953,9 +971,7 @@ impl SMBState { return None; } - pub fn new_negotiate_tx(&mut self, smb_ver: u8) - -> &mut SMBTransaction - { + pub fn new_negotiate_tx(&mut self, smb_ver: u8) -> &mut SMBTransaction { let mut tx = self.new_tx(); if smb_ver == 1 { tx.vercmd.set_smb1_cmd(SMB1_COMMAND_NEGOTIATE_PROTOCOL); @@ -964,25 +980,26 @@ impl SMBState { } tx.type_data = Some(SMBTransactionTypeData::NEGOTIATE( - SMBTransactionNegotiate::new(smb_ver))); + SMBTransactionNegotiate::new(smb_ver), + )); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated - SCLogDebug!("SMB: TX NEGOTIATE created: ID {} SMB ver {}", tx.id, smb_ver); + SCLogDebug!( + "SMB: TX NEGOTIATE created: ID {} SMB ver {}", + tx.id, + smb_ver + ); self.transactions.push_back(tx); let tx_ref = self.transactions.back_mut(); return tx_ref.unwrap(); } - pub fn get_negotiate_tx(&mut self, smb_ver: u8) - -> Option<&mut SMBTransaction> - { + pub fn get_negotiate_tx(&mut self, smb_ver: u8) -> Option<&mut SMBTransaction> { for tx in &mut self.transactions { let found = match tx.type_data { - Some(SMBTransactionTypeData::NEGOTIATE(ref x)) => { - x.smb_ver == smb_ver - }, - _ => { false }, + Some(SMBTransactionTypeData::NEGOTIATE(ref x)) => x.smb_ver == smb_ver, + _ => false, }; if found { return Some(tx); @@ -991,32 +1008,33 @@ impl SMBState { return None; } - pub fn new_treeconnect_tx(&mut self, hdr: SMBCommonHdr, name: Vec) - -> &mut SMBTransaction - { + pub fn new_treeconnect_tx(&mut self, hdr: SMBCommonHdr, name: Vec) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.hdr = hdr; tx.type_data = Some(SMBTransactionTypeData::TREECONNECT( - SMBTransactionTreeConnect::new(name.to_vec()))); + SMBTransactionTreeConnect::new(name.to_vec()), + )); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated - SCLogDebug!("SMB: TX TREECONNECT created: ID {} NAME {}", - tx.id, String::from_utf8_lossy(&name)); + SCLogDebug!( + "SMB: TX TREECONNECT created: ID {} NAME {}", + tx.id, + String::from_utf8_lossy(&name) + ); self.transactions.push_back(tx); let tx_ref = self.transactions.back_mut(); return tx_ref.unwrap(); } - pub fn get_treeconnect_tx(&mut self, hdr: SMBCommonHdr) - -> Option<&mut SMBTransaction> - { + pub fn get_treeconnect_tx(&mut self, hdr: SMBCommonHdr) -> Option<&mut SMBTransaction> { for tx in &mut self.transactions { - let hit = tx.hdr.compare(&hdr) && match tx.type_data { - Some(SMBTransactionTypeData::TREECONNECT(_)) => { true }, - _ => { false }, - }; + let hit = tx.hdr.compare(&hdr) + && match tx.type_data { + Some(SMBTransactionTypeData::TREECONNECT(_)) => true, + _ => false, + }; if hit { return Some(tx); } @@ -1024,17 +1042,17 @@ impl SMBState { return None; } - pub fn new_create_tx(&mut self, file_name: &[u8], - disposition: u32, del: bool, dir: bool, - hdr: SMBCommonHdr) - -> &mut SMBTransaction - { + pub fn new_create_tx( + &mut self, file_name: &[u8], disposition: u32, del: bool, dir: bool, hdr: SMBCommonHdr, + ) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.hdr = hdr; - tx.type_data = Some(SMBTransactionTypeData::CREATE( - SMBTransactionCreate::new( - file_name.to_vec(), disposition, - del, dir))); + tx.type_data = Some(SMBTransactionTypeData::CREATE(SMBTransactionCreate::new( + file_name.to_vec(), + disposition, + del, + dir, + ))); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated @@ -1043,8 +1061,7 @@ impl SMBState { return tx_ref.unwrap(); } - pub fn get_service_for_guid(&self, guid: &[u8]) -> (&'static str, bool) - { + pub fn get_service_for_guid(&self, guid: &[u8]) -> (&'static str, bool) { let (name, is_dcerpc) = match self.guid2name_map.get(&guid.to_vec()) { Some(n) => { let mut s = n.as_slice(); @@ -1066,17 +1083,16 @@ impl SMBState { Ok(&_) => { SCLogDebug!("don't know {}", String::from_utf8_lossy(n)); ("UNKNOWN", false) - }, + } } - }, - _ => { ("UNKNOWN", false) }, + } + _ => ("UNKNOWN", false), }; SCLogDebug!("service {} is_dcerpc {}", name, is_dcerpc); (name, is_dcerpc) } - fn post_gap_housekeeping_for_files(&mut self) - { + fn post_gap_housekeeping_for_files(&mut self) { let mut post_gap_txs = false; for tx in &mut self.transactions { if let Some(SMBTransactionTypeData::FILE(ref mut f)) = tx.type_data { @@ -1099,8 +1115,7 @@ impl SMBState { * can handle gaps. For the file transactions we set the current * (flow) time and prune them in 60 seconds if no update for them * was received. */ - fn post_gap_housekeeping(&mut self, dir: Direction) - { + fn post_gap_housekeeping(&mut self, dir: Direction) { if self.ts_ssn_gap && dir == Direction::ToServer { for tx in &mut self.transactions { if tx.id >= self.tx_id { @@ -1138,12 +1153,12 @@ impl SMBState { tx.response_done = true; } } - } } - pub fn set_file_left(&mut self, direction: Direction, rec_size: u32, data_size: u32, fuid: Vec) - { + pub fn set_file_left( + &mut self, direction: Direction, rec_size: u32, data_size: u32, fuid: Vec, + ) { let left = rec_size.saturating_sub(data_size); if direction == Direction::ToServer { self.file_ts_left = left; @@ -1154,8 +1169,7 @@ impl SMBState { } } - pub fn set_skip(&mut self, direction: Direction, nbss_remaining: u32) - { + pub fn set_skip(&mut self, direction: Direction, nbss_remaining: u32) { if direction == Direction::ToServer { self.skip_ts = nbss_remaining; } else { @@ -1171,7 +1185,7 @@ impl SMBState { self.skip_tc }; if skip_left == 0 { - return 0 + return 0; } SCLogDebug!("skip_left {} input_size {}", skip_left, input_size); @@ -1195,61 +1209,149 @@ impl SMBState { return consumed; } - fn add_nbss_ts_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) -> (Option, Option, Option) { - let nbss_pdu = Frame::new(flow, stream_slice, input, nbss_len + 4, SMBFrameType::NBSSPdu as u8); + fn add_nbss_ts_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) -> (Option, Option, Option) { + let nbss_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len + 4, + SMBFrameType::NBSSPdu as u8, + ); SCLogDebug!("NBSS PDU frame {:?}", nbss_pdu); - let nbss_hdr_frame = Frame::new(flow, stream_slice, input, 4_i64, SMBFrameType::NBSSHdr as u8); + let nbss_hdr_frame = Frame::new( + flow, + stream_slice, + input, + 4_i64, + SMBFrameType::NBSSHdr as u8, + ); SCLogDebug!("NBSS HDR frame {:?}", nbss_hdr_frame); - let nbss_data_frame = Frame::new(flow, stream_slice, &input[4..], nbss_len, SMBFrameType::NBSSData as u8); + let nbss_data_frame = Frame::new( + flow, + stream_slice, + &input[4..], + nbss_len, + SMBFrameType::NBSSData as u8, + ); SCLogDebug!("NBSS DATA frame {:?}", nbss_data_frame); (nbss_pdu, nbss_hdr_frame, nbss_data_frame) } - fn add_smb1_ts_pdu_frame(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) -> Option { - let smb_pdu = Frame::new(flow, stream_slice, input, nbss_len, SMBFrameType::SMB1Pdu as u8); + fn add_smb1_ts_pdu_frame( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) -> Option { + let smb_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len, + SMBFrameType::SMB1Pdu as u8, + ); SCLogDebug!("SMB PDU frame {:?}", smb_pdu); smb_pdu } - fn add_smb1_ts_hdr_data_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) { - let _smb1_hdr = Frame::new(flow, stream_slice, input, 32_i64, SMBFrameType::SMB1Hdr as u8); + fn add_smb1_ts_hdr_data_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) { + let _smb1_hdr = Frame::new( + flow, + stream_slice, + input, + 32_i64, + SMBFrameType::SMB1Hdr as u8, + ); SCLogDebug!("SMBv1 HDR frame {:?}", _smb1_hdr); if input.len() > 32 { - let _smb1_data = Frame::new(flow, stream_slice, &input[32..], nbss_len - 32, SMBFrameType::SMB1Data as u8); + let _smb1_data = Frame::new( + flow, + stream_slice, + &input[32..], + nbss_len - 32, + SMBFrameType::SMB1Data as u8, + ); SCLogDebug!("SMBv1 DATA frame {:?}", _smb1_data); } } - fn add_smb2_ts_pdu_frame(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) -> Option { - let smb_pdu = Frame::new(flow, stream_slice, input, nbss_len, SMBFrameType::SMB2Pdu as u8); + fn add_smb2_ts_pdu_frame( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) -> Option { + let smb_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len, + SMBFrameType::SMB2Pdu as u8, + ); SCLogDebug!("SMBv2 PDU frame {:?}", smb_pdu); smb_pdu } - fn add_smb2_ts_hdr_data_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, hdr_len: i64) { - let _smb2_hdr = Frame::new(flow, stream_slice, input, hdr_len, SMBFrameType::SMB2Hdr as u8); + fn add_smb2_ts_hdr_data_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + hdr_len: i64, + ) { + let _smb2_hdr = Frame::new( + flow, + stream_slice, + input, + hdr_len, + SMBFrameType::SMB2Hdr as u8, + ); SCLogDebug!("SMBv2 HDR frame {:?}", _smb2_hdr); if input.len() > hdr_len as usize { - let _smb2_data = Frame::new(flow, stream_slice, &input[hdr_len as usize..], nbss_len - hdr_len, SMBFrameType::SMB2Data as u8); + let _smb2_data = Frame::new( + flow, + stream_slice, + &input[hdr_len as usize..], + nbss_len - hdr_len, + SMBFrameType::SMB2Data as u8, + ); SCLogDebug!("SMBv2 DATA frame {:?}", _smb2_data); } } - fn add_smb3_ts_pdu_frame(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) -> Option { - let smb_pdu = Frame::new(flow, stream_slice, input, nbss_len, SMBFrameType::SMB3Pdu as u8); + fn add_smb3_ts_pdu_frame( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) -> Option { + let smb_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len, + SMBFrameType::SMB3Pdu as u8, + ); SCLogDebug!("SMBv3 PDU frame {:?}", smb_pdu); smb_pdu } - fn add_smb3_ts_hdr_data_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) { - let _smb3_hdr = Frame::new(flow, stream_slice, input, 52_i64, SMBFrameType::SMB3Hdr as u8); + fn add_smb3_ts_hdr_data_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) { + let _smb3_hdr = Frame::new( + flow, + stream_slice, + input, + 52_i64, + SMBFrameType::SMB3Hdr as u8, + ); SCLogDebug!("SMBv3 HDR frame {:?}", _smb3_hdr); if input.len() > 52 { - let _smb3_data = Frame::new(flow, stream_slice, &input[52..], nbss_len - 52, SMBFrameType::SMB3Data as u8); + let _smb3_data = Frame::new( + flow, + stream_slice, + &input[52..], + nbss_len - 52, + SMBFrameType::SMB3Data as u8, + ); SCLogDebug!("SMBv3 DATA frame {:?}", _smb3_data); } } /// return bytes consumed - pub fn parse_tcp_data_ts_partial(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8]) -> usize - { + pub fn parse_tcp_data_ts_partial( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], + ) -> usize { SCLogDebug!("incomplete of size {}", input.len()); if input.len() < 512 { // check for malformed data. Wireshark reports as @@ -1258,7 +1360,10 @@ impl SMBState { if input.len() > 8 { if let Ok((_, ref hdr)) = parse_nbss_record_partial(input) { if !hdr.is_smb() { - SCLogDebug!("partial NBSS, not SMB and no known msg type {}", hdr.message_type); + SCLogDebug!( + "partial NBSS, not SMB and no known msg type {}", + hdr.message_type + ); self.trunc_ts(); return 0; } @@ -1272,14 +1377,19 @@ impl SMBState { if nbss_part_hdr.message_type == NBSS_MSGTYPE_SESSION_MESSAGE { if let Ok((_, ref smb)) = parse_smb_version(nbss_part_hdr.data) { SCLogDebug!("SMB {:?}", smb); - if smb.version == 0xff_u8 { // SMB1 + if smb.version == 0xff_u8 { + // SMB1 SCLogDebug!("SMBv1 record"); if let Ok((_, ref r)) = parse_smb_record(nbss_part_hdr.data) { if r.command == SMB1_COMMAND_WRITE_ANDX { // see if it's a write to a pipe. We only handle those // if complete. - let tree_key = SMBCommonHdr::new(SMBHDR_TYPE_SHARE, - r.ssn_id as u64, r.tree_id as u32, 0); + let tree_key = SMBCommonHdr::new( + SMBHDR_TYPE_SHARE, + r.ssn_id as u64, + r.tree_id as u32, + 0, + ); let is_pipe = match self.ssn2tree_map.get(&tree_key) { Some(n) => n.is_pipe, None => false, @@ -1290,33 +1400,77 @@ impl SMBState { // how many more bytes are expected within this NBSS record // So that we can check that further parsed offsets and lengths // stay within the NBSS record. - let nbss_remaining = nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; - smb1_write_request_record(self, r, SMB1_HEADER_SIZE, SMB1_COMMAND_WRITE_ANDX, nbss_remaining); + let nbss_remaining = + nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; + smb1_write_request_record( + self, + r, + SMB1_HEADER_SIZE, + SMB1_COMMAND_WRITE_ANDX, + nbss_remaining, + ); + + self.add_nbss_ts_frames( + flow, + stream_slice, + input, + nbss_part_hdr.length as i64, + ); + self.add_smb1_ts_pdu_frame( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + ); + self.add_smb1_ts_hdr_data_frames( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + ); - self.add_nbss_ts_frames(flow, stream_slice, input, nbss_part_hdr.length as i64); - self.add_smb1_ts_pdu_frame(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64); - self.add_smb1_ts_hdr_data_frames(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64); - let consumed = input.len() - output.len(); return consumed; } } - } else if smb.version == 0xfe_u8 { // SMB2 + } else if smb.version == 0xfe_u8 { + // SMB2 SCLogDebug!("SMBv2 record"); - if let Ok((_, ref smb_record)) = parse_smb2_request_record(nbss_part_hdr.data) { - SCLogDebug!("SMB2: partial record {}", - &smb2_command_string(smb_record.command)); + if let Ok((_, ref smb_record)) = + parse_smb2_request_record(nbss_part_hdr.data) + { + SCLogDebug!( + "SMB2: partial record {}", + &smb2_command_string(smb_record.command) + ); if smb_record.command == SMB2_COMMAND_WRITE { // how many more bytes are expected within this NBSS record // So that we can check that further parsed offsets and lengths // stay within the NBSS record. - let nbss_remaining = nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; + let nbss_remaining = + nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; smb2_write_request_record(self, smb_record, nbss_remaining); - self.add_nbss_ts_frames(flow, stream_slice, input, nbss_part_hdr.length as i64); - self.add_smb2_ts_pdu_frame(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64); - self.add_smb2_ts_hdr_data_frames(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64, smb_record.header_len as i64); - + self.add_nbss_ts_frames( + flow, + stream_slice, + input, + nbss_part_hdr.length as i64, + ); + self.add_smb2_ts_pdu_frame( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + ); + self.add_smb2_ts_hdr_data_frames( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + smb_record.header_len as i64, + ); + let consumed = input.len() - output.len(); SCLogDebug!("consumed {}", consumed); return consumed; @@ -1332,8 +1486,9 @@ impl SMBState { } /// Parsing function, handling TCP chunks fragmentation - pub fn parse_tcp_data_ts(&mut self, flow: *const Flow, stream_slice: &StreamSlice) -> AppLayerResult - { + pub fn parse_tcp_data_ts( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, + ) -> AppLayerResult { let mut cur_i = stream_slice.as_slice(); let consumed = self.handle_skip(Direction::ToServer, cur_i.len() as u32); if consumed > 0 { @@ -1359,13 +1514,14 @@ impl SMBState { // gap if self.ts_gap { SCLogDebug!("TS trying to catch up after GAP (input {})", cur_i.len()); - while !cur_i.is_empty() { // min record size + while !cur_i.is_empty() { + // min record size match search_smb_record(cur_i) { Ok((_, pg)) => { SCLogDebug!("smb record found"); let smb2_offset = cur_i.len() - pg.len(); if smb2_offset < 4 { - cur_i = &cur_i[smb2_offset+4..]; + cur_i = &cur_i[smb2_offset + 4..]; continue; // see if we have another record in our data } let nbss_offset = smb2_offset - 4; @@ -1373,7 +1529,7 @@ impl SMBState { self.ts_gap = false; break; - }, + } _ => { let mut consumed = stream_slice.len(); if consumed < 4 { @@ -1383,113 +1539,174 @@ impl SMBState { } SCLogDebug!("smb record NOT found"); return AppLayerResult::incomplete(consumed, 8); - }, + } } } } - while !cur_i.is_empty() { // min record size + while !cur_i.is_empty() { + // min record size match parse_nbss_record(cur_i) { Ok((rem, ref nbss_hdr)) => { - SCLogDebug!("nbss frame offset {} len {}", stream_slice.offset_from(cur_i), cur_i.len() - rem.len()); - let (_, _, nbss_data_frame) = self.add_nbss_ts_frames(flow, stream_slice, cur_i, nbss_hdr.length as i64); + SCLogDebug!( + "nbss frame offset {} len {}", + stream_slice.offset_from(cur_i), + cur_i.len() - rem.len() + ); + let (_, _, nbss_data_frame) = + self.add_nbss_ts_frames(flow, stream_slice, cur_i, nbss_hdr.length as i64); if nbss_hdr.message_type == NBSS_MSGTYPE_SESSION_MESSAGE { // we have the full records size worth of data, // let's parse it match parse_smb_version(nbss_hdr.data) { Ok((_, ref smb)) => { - SCLogDebug!("SMB {:?}", smb); - if smb.version == 0xff_u8 { // SMB1 + if smb.version == 0xff_u8 { + // SMB1 SCLogDebug!("SMBv1 record"); match parse_smb_record(nbss_hdr.data) { Ok((_, ref smb_record)) => { - let pdu_frame = self.add_smb1_ts_pdu_frame(flow, stream_slice, nbss_hdr.data, nbss_hdr.length as i64); - self.add_smb1_ts_hdr_data_frames(flow, stream_slice, nbss_hdr.data, nbss_hdr.length as i64); + let pdu_frame = self.add_smb1_ts_pdu_frame( + flow, + stream_slice, + nbss_hdr.data, + nbss_hdr.length as i64, + ); + self.add_smb1_ts_hdr_data_frames( + flow, + stream_slice, + nbss_hdr.data, + nbss_hdr.length as i64, + ); if smb_record.is_request() { smb1_request_record(self, smb_record); } else { // If we received a response when expecting a request, set an event // on the PDU frame instead of handling the response. - SCLogDebug!("SMB1 reply seen from client to server"); + SCLogDebug!( + "SMB1 reply seen from client to server" + ); if let Some(frame) = pdu_frame { - frame.add_event(flow, SMBEvent::ResponseToServer as u8); + frame.add_event( + flow, + SMBEvent::ResponseToServer as u8, + ); } } - }, + } _ => { if let Some(frame) = nbss_data_frame { - frame.add_event(flow, SMBEvent::MalformedData as u8); + frame + .add_event(flow, SMBEvent::MalformedData as u8); } self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } - } else if smb.version == 0xfe_u8 { // SMB2 + } else if smb.version == 0xfe_u8 { + // SMB2 let mut nbss_data = nbss_hdr.data; while !nbss_data.is_empty() { SCLogDebug!("SMBv2 record"); match parse_smb2_request_record(nbss_data) { Ok((nbss_data_rem, ref smb_record)) => { - let record_len = (nbss_data.len() - nbss_data_rem.len()) as i64; - let pdu_frame = self.add_smb2_ts_pdu_frame(flow, stream_slice, nbss_data, record_len); - self.add_smb2_ts_hdr_data_frames(flow, stream_slice, nbss_data, record_len, smb_record.header_len as i64); - SCLogDebug!("nbss_data_rem {}", nbss_data_rem.len()); + let record_len = + (nbss_data.len() - nbss_data_rem.len()) as i64; + let pdu_frame = self.add_smb2_ts_pdu_frame( + flow, + stream_slice, + nbss_data, + record_len, + ); + self.add_smb2_ts_hdr_data_frames( + flow, + stream_slice, + nbss_data, + record_len, + smb_record.header_len as i64, + ); + SCLogDebug!( + "nbss_data_rem {}", + nbss_data_rem.len() + ); if smb_record.is_request() { smb2_request_record(self, smb_record); } else { // If we received a response when expecting a request, set an event // on the PDU frame instead of handling the response. - SCLogDebug!("SMB2 reply seen from client to server"); + SCLogDebug!( + "SMB2 reply seen from client to server" + ); if let Some(frame) = pdu_frame { - frame.add_event(flow, SMBEvent::ResponseToServer as u8); + frame.add_event( + flow, + SMBEvent::ResponseToServer as u8, + ); } } nbss_data = nbss_data_rem; - }, + } _ => { if let Some(frame) = nbss_data_frame { - frame.add_event(flow, SMBEvent::MalformedData as u8); + frame.add_event( + flow, + SMBEvent::MalformedData as u8, + ); } self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } } - } else if smb.version == 0xfd_u8 { // SMB3 transform + } else if smb.version == 0xfd_u8 { + // SMB3 transform let mut nbss_data = nbss_hdr.data; while !nbss_data.is_empty() { SCLogDebug!("SMBv3 transform record"); match parse_smb3_transform_record(nbss_data) { Ok((nbss_data_rem, ref _smb3_record)) => { - let record_len = (nbss_data.len() - nbss_data_rem.len()) as i64; - self.add_smb3_ts_pdu_frame(flow, stream_slice, nbss_data, record_len); - self.add_smb3_ts_hdr_data_frames(flow, stream_slice, nbss_data, record_len); + let record_len = + (nbss_data.len() - nbss_data_rem.len()) as i64; + self.add_smb3_ts_pdu_frame( + flow, + stream_slice, + nbss_data, + record_len, + ); + self.add_smb3_ts_hdr_data_frames( + flow, + stream_slice, + nbss_data, + record_len, + ); nbss_data = nbss_data_rem; - }, + } _ => { if let Some(frame) = nbss_data_frame { - frame.add_event(flow, SMBEvent::MalformedData as u8); + frame.add_event( + flow, + SMBEvent::MalformedData as u8, + ); } self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } } } - }, + } _ => { self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } } else { SCLogDebug!("NBSS message {:X}", nbss_hdr.message_type); } cur_i = rem; - }, + } Err(Err::Incomplete(needed)) => { if let Needed::Size(n) = needed { let n = usize::from(n) + cur_i.len(); @@ -1502,8 +1719,13 @@ impl SMBState { if consumed == 0 { // if we consumed none we will buffer the entire record let total_consumed = stream_slice.offset_from(cur_i); - SCLogDebug!("setting consumed {} need {} needed {:?} total input {}", - total_consumed, n, needed, stream_slice.len()); + SCLogDebug!( + "setting consumed {} need {} needed {:?} total input {}", + total_consumed, + n, + needed, + stream_slice.len() + ); let need = n; return AppLayerResult::incomplete(total_consumed, need as u32); } @@ -1515,13 +1737,13 @@ impl SMBState { self.set_event(SMBEvent::InternalError); return AppLayerResult::err(); } - }, + } Err(_) => { self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } - }; + } self.post_gap_housekeeping(Direction::ToServer); if self.check_post_gap_file_txs && !self.post_gap_files_checked { @@ -1531,61 +1753,148 @@ impl SMBState { AppLayerResult::ok() } - fn add_nbss_tc_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) -> (Option, Option, Option) { - let nbss_pdu = Frame::new(flow, stream_slice, input, nbss_len + 4, SMBFrameType::NBSSPdu as u8); + fn add_nbss_tc_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) -> (Option, Option, Option) { + let nbss_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len + 4, + SMBFrameType::NBSSPdu as u8, + ); SCLogDebug!("NBSS PDU frame {:?}", nbss_pdu); - let nbss_hdr_frame = Frame::new(flow, stream_slice, input, 4_i64, SMBFrameType::NBSSHdr as u8); + let nbss_hdr_frame = Frame::new( + flow, + stream_slice, + input, + 4_i64, + SMBFrameType::NBSSHdr as u8, + ); SCLogDebug!("NBSS HDR frame {:?}", nbss_hdr_frame); - let nbss_data_frame = Frame::new(flow, stream_slice, &input[4..], nbss_len, SMBFrameType::NBSSData as u8); + let nbss_data_frame = Frame::new( + flow, + stream_slice, + &input[4..], + nbss_len, + SMBFrameType::NBSSData as u8, + ); SCLogDebug!("NBSS DATA frame {:?}", nbss_data_frame); (nbss_pdu, nbss_hdr_frame, nbss_data_frame) } - fn add_smb1_tc_pdu_frame(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) -> Option { - let smb_pdu = Frame::new(flow, stream_slice, input, nbss_len, SMBFrameType::SMB1Pdu as u8); + fn add_smb1_tc_pdu_frame( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) -> Option { + let smb_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len, + SMBFrameType::SMB1Pdu as u8, + ); SCLogDebug!("SMB PDU frame {:?}", smb_pdu); smb_pdu } - fn add_smb1_tc_hdr_data_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) { - let _smb1_hdr = Frame::new(flow, stream_slice, input, SMB1_HEADER_SIZE as i64, SMBFrameType::SMB1Hdr as u8); + fn add_smb1_tc_hdr_data_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) { + let _smb1_hdr = Frame::new( + flow, + stream_slice, + input, + SMB1_HEADER_SIZE as i64, + SMBFrameType::SMB1Hdr as u8, + ); SCLogDebug!("SMBv1 HDR frame {:?}", _smb1_hdr); if input.len() > SMB1_HEADER_SIZE { - let _smb1_data = Frame::new(flow, stream_slice, &input[SMB1_HEADER_SIZE..], nbss_len - SMB1_HEADER_SIZE as i64, - SMBFrameType::SMB1Data as u8); + let _smb1_data = Frame::new( + flow, + stream_slice, + &input[SMB1_HEADER_SIZE..], + nbss_len - SMB1_HEADER_SIZE as i64, + SMBFrameType::SMB1Data as u8, + ); SCLogDebug!("SMBv1 DATA frame {:?}", _smb1_data); } } - fn add_smb2_tc_pdu_frame(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) -> Option { - let smb_pdu = Frame::new(flow, stream_slice, input, nbss_len, SMBFrameType::SMB2Pdu as u8); + fn add_smb2_tc_pdu_frame( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) -> Option { + let smb_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len, + SMBFrameType::SMB2Pdu as u8, + ); SCLogDebug!("SMBv2 PDU frame {:?}", smb_pdu); smb_pdu } - fn add_smb2_tc_hdr_data_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, hdr_len: i64) { - let _smb2_hdr = Frame::new(flow, stream_slice, input, hdr_len, SMBFrameType::SMB2Hdr as u8); + fn add_smb2_tc_hdr_data_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + hdr_len: i64, + ) { + let _smb2_hdr = Frame::new( + flow, + stream_slice, + input, + hdr_len, + SMBFrameType::SMB2Hdr as u8, + ); SCLogDebug!("SMBv2 HDR frame {:?}", _smb2_hdr); if input.len() > hdr_len as usize { - let _smb2_data = Frame::new(flow, stream_slice, &input[hdr_len as usize ..], nbss_len - hdr_len, SMBFrameType::SMB2Data as u8); + let _smb2_data = Frame::new( + flow, + stream_slice, + &input[hdr_len as usize..], + nbss_len - hdr_len, + SMBFrameType::SMB2Data as u8, + ); SCLogDebug!("SMBv2 DATA frame {:?}", _smb2_data); } } - fn add_smb3_tc_pdu_frame(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) { - let _smb_pdu = Frame::new(flow, stream_slice, input, nbss_len, SMBFrameType::SMB3Pdu as u8); + fn add_smb3_tc_pdu_frame( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) { + let _smb_pdu = Frame::new( + flow, + stream_slice, + input, + nbss_len, + SMBFrameType::SMB3Pdu as u8, + ); SCLogDebug!("SMBv3 PDU frame {:?}", _smb_pdu); } - fn add_smb3_tc_hdr_data_frames(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64) { - let _smb3_hdr = Frame::new(flow, stream_slice, input, 52_i64, SMBFrameType::SMB3Hdr as u8); + fn add_smb3_tc_hdr_data_frames( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], nbss_len: i64, + ) { + let _smb3_hdr = Frame::new( + flow, + stream_slice, + input, + 52_i64, + SMBFrameType::SMB3Hdr as u8, + ); SCLogDebug!("SMBv3 HDR frame {:?}", _smb3_hdr); if input.len() > 52 { - let _smb3_data = Frame::new(flow, stream_slice, &input[52..], nbss_len - 52, SMBFrameType::SMB3Data as u8); + let _smb3_data = Frame::new( + flow, + stream_slice, + &input[52..], + nbss_len - 52, + SMBFrameType::SMB3Data as u8, + ); SCLogDebug!("SMBv3 DATA frame {:?}", _smb3_data); } } /// return bytes consumed - pub fn parse_tcp_data_tc_partial(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8]) -> usize - { + pub fn parse_tcp_data_tc_partial( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], + ) -> usize { SCLogDebug!("incomplete of size {}", input.len()); if input.len() < 512 { // check for malformed data. Wireshark reports as @@ -1594,7 +1903,10 @@ impl SMBState { if input.len() > 8 { if let Ok((_, ref hdr)) = parse_nbss_record_partial(input) { if !hdr.is_smb() { - SCLogDebug!("partial NBSS, not SMB and no known msg type {}", hdr.message_type); + SCLogDebug!( + "partial NBSS, not SMB and no known msg type {}", + hdr.message_type + ); self.trunc_tc(); return 0; } @@ -1608,17 +1920,21 @@ impl SMBState { if nbss_part_hdr.message_type == NBSS_MSGTYPE_SESSION_MESSAGE { if let Ok((_, ref smb)) = parse_smb_version(nbss_part_hdr.data) { SCLogDebug!("SMB {:?}", smb); - if smb.version == 255u8 { // SMB1 + if smb.version == 255u8 { + // SMB1 SCLogDebug!("SMBv1 record"); if let Ok((_, ref r)) = parse_smb_record(nbss_part_hdr.data) { - SCLogDebug!("SMB1: partial record {}", - r.command); + SCLogDebug!("SMB1: partial record {}", r.command); if r.command == SMB1_COMMAND_READ_ANDX { - let tree_key = SMBCommonHdr::new(SMBHDR_TYPE_SHARE, - r.ssn_id as u64, r.tree_id as u32, 0); + let tree_key = SMBCommonHdr::new( + SMBHDR_TYPE_SHARE, + r.ssn_id as u64, + r.tree_id as u32, + 0, + ); let is_pipe = match self.ssn2tree_map.get(&tree_key) { Some(n) => n.is_pipe, - None => false, + None => false, }; if is_pipe { return 0; @@ -1626,35 +1942,78 @@ impl SMBState { // create NBSS frames here so we don't get double frames // when we don't consume the data now. - self.add_nbss_tc_frames(flow, stream_slice, input, nbss_part_hdr.length as i64); - self.add_smb1_tc_pdu_frame(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64); - self.add_smb1_tc_hdr_data_frames(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64); + self.add_nbss_tc_frames( + flow, + stream_slice, + input, + nbss_part_hdr.length as i64, + ); + self.add_smb1_tc_pdu_frame( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + ); + self.add_smb1_tc_hdr_data_frames( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + ); // how many more bytes are expected within this NBSS record // So that we can check that further parsed offsets and lengths // stay within the NBSS record. - let nbss_remaining = nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; - smb1_read_response_record(self, r, SMB1_HEADER_SIZE, nbss_remaining); + let nbss_remaining = + nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; + smb1_read_response_record( + self, + r, + SMB1_HEADER_SIZE, + nbss_remaining, + ); let consumed = input.len() - output.len(); return consumed; } } - } else if smb.version == 254u8 { // SMB2 + } else if smb.version == 254u8 { + // SMB2 SCLogDebug!("SMBv2 record"); - if let Ok((_, ref smb_record)) = parse_smb2_response_record(nbss_part_hdr.data) { - SCLogDebug!("SMB2: partial record {}", - &smb2_command_string(smb_record.command)); + if let Ok((_, ref smb_record)) = + parse_smb2_response_record(nbss_part_hdr.data) + { + SCLogDebug!( + "SMB2: partial record {}", + &smb2_command_string(smb_record.command) + ); if smb_record.command == SMB2_COMMAND_READ { // create NBSS frames here so we don't get double frames // when we don't consume the data now. - self.add_nbss_tc_frames(flow, stream_slice, input, nbss_part_hdr.length as i64); - self.add_smb2_tc_pdu_frame(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64); - self.add_smb2_tc_hdr_data_frames(flow, stream_slice, nbss_part_hdr.data, nbss_part_hdr.length as i64, smb_record.header_len as i64); + self.add_nbss_tc_frames( + flow, + stream_slice, + input, + nbss_part_hdr.length as i64, + ); + self.add_smb2_tc_pdu_frame( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + ); + self.add_smb2_tc_hdr_data_frames( + flow, + stream_slice, + nbss_part_hdr.data, + nbss_part_hdr.length as i64, + smb_record.header_len as i64, + ); // how many more bytes are expected within this NBSS record // So that we can check that further parsed offsets and lengths // stay within the NBSS record. - let nbss_remaining = nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; + let nbss_remaining = + nbss_part_hdr.length - nbss_part_hdr.data.len() as u32; smb2_read_response_record(self, smb_record, nbss_remaining); let consumed = input.len() - output.len(); return consumed; @@ -1669,8 +2028,9 @@ impl SMBState { } /// Parsing function, handling TCP chunks fragmentation - pub fn parse_tcp_data_tc(&mut self, flow: *const Flow, stream_slice: &StreamSlice) -> AppLayerResult - { + pub fn parse_tcp_data_tc( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, + ) -> AppLayerResult { let mut cur_i = stream_slice.as_slice(); let consumed = self.handle_skip(Direction::ToClient, cur_i.len() as u32); if consumed > 0 { @@ -1696,13 +2056,14 @@ impl SMBState { // gap if self.tc_gap { SCLogDebug!("TC trying to catch up after GAP (input {})", cur_i.len()); - while !cur_i.is_empty() { // min record size + while !cur_i.is_empty() { + // min record size match search_smb_record(cur_i) { Ok((_, pg)) => { SCLogDebug!("smb record found"); let smb2_offset = cur_i.len() - pg.len(); if smb2_offset < 4 { - cur_i = &cur_i[smb2_offset+4..]; + cur_i = &cur_i[smb2_offset + 4..]; continue; // see if we have another record in our data } let nbss_offset = smb2_offset - 4; @@ -1710,7 +2071,7 @@ impl SMBState { self.tc_gap = false; break; - }, + } _ => { let mut consumed = stream_slice.len(); if consumed < 4 { @@ -1720,14 +2081,19 @@ impl SMBState { } SCLogDebug!("smb record NOT found"); return AppLayerResult::incomplete(consumed, 8); - }, + } } } } - while !cur_i.is_empty() { // min record size + while !cur_i.is_empty() { + // min record size match parse_nbss_record(cur_i) { Ok((rem, ref nbss_hdr)) => { - SCLogDebug!("nbss record offset {} len {}", stream_slice.offset_from(cur_i), cur_i.len() - rem.len()); + SCLogDebug!( + "nbss record offset {} len {}", + stream_slice.offset_from(cur_i), + cur_i.len() - rem.len() + ); self.add_nbss_tc_frames(flow, stream_slice, cur_i, nbss_hdr.length as i64); SCLogDebug!("nbss frames added"); @@ -1737,84 +2103,130 @@ impl SMBState { match parse_smb_version(nbss_hdr.data) { Ok((_, ref smb)) => { SCLogDebug!("SMB {:?}", smb); - if smb.version == 0xff_u8 { // SMB1 + if smb.version == 0xff_u8 { + // SMB1 SCLogDebug!("SMBv1 record"); match parse_smb_record(nbss_hdr.data) { Ok((_, ref smb_record)) => { - let pdu_frame = self.add_smb1_tc_pdu_frame(flow, stream_slice, nbss_hdr.data, nbss_hdr.length as i64); - self.add_smb1_tc_hdr_data_frames(flow, stream_slice, nbss_hdr.data, nbss_hdr.length as i64); + let pdu_frame = self.add_smb1_tc_pdu_frame( + flow, + stream_slice, + nbss_hdr.data, + nbss_hdr.length as i64, + ); + self.add_smb1_tc_hdr_data_frames( + flow, + stream_slice, + nbss_hdr.data, + nbss_hdr.length as i64, + ); if smb_record.is_response() { smb1_response_record(self, smb_record); } else { - SCLogDebug!("SMB1 request seen from server to client"); + SCLogDebug!( + "SMB1 request seen from server to client" + ); if let Some(frame) = pdu_frame { - frame.add_event(flow, SMBEvent::RequestToClient as u8); + frame.add_event( + flow, + SMBEvent::RequestToClient as u8, + ); } } - }, + } _ => { self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } - } else if smb.version == 0xfe_u8 { // SMB2 + } else if smb.version == 0xfe_u8 { + // SMB2 let mut nbss_data = nbss_hdr.data; while !nbss_data.is_empty() { SCLogDebug!("SMBv2 record"); match parse_smb2_response_record(nbss_data) { Ok((nbss_data_rem, ref smb_record)) => { - let record_len = (nbss_data.len() - nbss_data_rem.len()) as i64; - let pdu_frame = self.add_smb2_tc_pdu_frame(flow, stream_slice, nbss_data, record_len); - self.add_smb2_tc_hdr_data_frames(flow, stream_slice, nbss_data, record_len, smb_record.header_len as i64); + let record_len = + (nbss_data.len() - nbss_data_rem.len()) as i64; + let pdu_frame = self.add_smb2_tc_pdu_frame( + flow, + stream_slice, + nbss_data, + record_len, + ); + self.add_smb2_tc_hdr_data_frames( + flow, + stream_slice, + nbss_data, + record_len, + smb_record.header_len as i64, + ); if smb_record.is_response() { smb2_response_record(self, smb_record); } else { - SCLogDebug!("SMB2 request seen from server to client"); + SCLogDebug!( + "SMB2 request seen from server to client" + ); if let Some(frame) = pdu_frame { - frame.add_event(flow, SMBEvent::RequestToClient as u8); + frame.add_event( + flow, + SMBEvent::RequestToClient as u8, + ); } } nbss_data = nbss_data_rem; - }, + } _ => { self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } } - } else if smb.version == 0xfd_u8 { // SMB3 transform + } else if smb.version == 0xfd_u8 { + // SMB3 transform let mut nbss_data = nbss_hdr.data; while !nbss_data.is_empty() { SCLogDebug!("SMBv3 transform record"); match parse_smb3_transform_record(nbss_data) { Ok((nbss_data_rem, ref _smb3_record)) => { - let record_len = (nbss_data.len() - nbss_data_rem.len()) as i64; - self.add_smb3_tc_pdu_frame(flow, stream_slice, nbss_data, record_len); - self.add_smb3_tc_hdr_data_frames(flow, stream_slice, nbss_data, record_len); + let record_len = + (nbss_data.len() - nbss_data_rem.len()) as i64; + self.add_smb3_tc_pdu_frame( + flow, + stream_slice, + nbss_data, + record_len, + ); + self.add_smb3_tc_hdr_data_frames( + flow, + stream_slice, + nbss_data, + record_len, + ); nbss_data = nbss_data_rem; - }, + } _ => { self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } } } - }, + } Err(Err::Incomplete(_)) => { // not enough data to contain basic SMB hdr // TODO event: empty NBSS_MSGTYPE_SESSION_MESSAGE - }, + } Err(_) => { self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } } else { SCLogDebug!("NBSS message {:X}", nbss_hdr.message_type); } cur_i = rem; - }, + } Err(Err::Incomplete(needed)) => { SCLogDebug!("INCOMPLETE have {} needed {:?}", cur_i.len(), needed); if let Needed::Size(n) = needed { @@ -1828,8 +2240,13 @@ impl SMBState { if consumed == 0 { // if we consumed none we will buffer the entire record let total_consumed = stream_slice.offset_from(cur_i); - SCLogDebug!("setting consumed {} need {} needed {:?} total input {}", - total_consumed, n, needed, stream_slice.len()); + SCLogDebug!( + "setting consumed {} need {} needed {:?} total input {}", + total_consumed, + n, + needed, + stream_slice.len() + ); let need = n; return AppLayerResult::incomplete(total_consumed, need as u32); } @@ -1841,13 +2258,13 @@ impl SMBState { self.set_event(SMBEvent::InternalError); return AppLayerResult::err(); } - }, + } Err(_) => { self.set_event(SMBEvent::MalformedData); return AppLayerResult::err(); - }, + } } - }; + } self.post_gap_housekeeping(Direction::ToClient); if self.check_post_gap_file_txs && !self.post_gap_files_checked { self.post_gap_housekeeping_for_files(); @@ -1867,7 +2284,11 @@ impl SMBState { let consumed2 = self.filetracker_update(Direction::ToServer, &gap, new_gap_size); if consumed2 > new_gap_size { - SCLogDebug!("consumed more than GAP size: {} > {}", consumed2, new_gap_size); + SCLogDebug!( + "consumed more than GAP size: {} > {}", + consumed2, + new_gap_size + ); self.set_event(SMBEvent::InternalError); return AppLayerResult::err(); } @@ -1888,7 +2309,11 @@ impl SMBState { let consumed2 = self.filetracker_update(Direction::ToClient, &gap, new_gap_size); if consumed2 > new_gap_size { - SCLogDebug!("consumed more than GAP size: {} > {}", consumed2, new_gap_size); + SCLogDebug!( + "consumed more than GAP size: {} > {}", + consumed2, + new_gap_size + ); self.set_event(SMBEvent::InternalError); return AppLayerResult::err(); } @@ -1908,7 +2333,7 @@ impl SMBState { SCLogDebug!("TRUNCATING TX {} in TOSERVER direction", tx.id); tx.request_done = true; } - } + } } pub fn trunc_tc(&mut self) { SCLogDebug!("TRUNC TC"); @@ -1925,7 +2350,9 @@ impl SMBState { /// Returns *mut SMBState #[no_mangle] -pub extern "C" fn rs_smb_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_smb_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = SMBState::new(); let boxed = Box::new(state); SCLogDebug!("allocating state"); @@ -1935,7 +2362,7 @@ pub extern "C" fn rs_smb_state_new(_orig_state: *mut std::os::raw::c_void, _orig /// Params: /// - state: *mut SMBState as void pointer #[no_mangle] -pub extern "C" fn rs_smb_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_smb_state_free(state: *mut std::os::raw::c_void) { SCLogDebug!("freeing state"); let mut smb_state = unsafe { Box::from_raw(state as *mut SMBState) }; smb_state.free(); @@ -1943,14 +2370,10 @@ pub extern "C" fn rs_smb_state_free(state: *mut std::os::raw::c_void) { /// C binding parse a SMB request. Returns 1 on success, -1 on failure. #[no_mangle] -pub unsafe extern "C" fn rs_smb_parse_request_tcp(flow: *const Flow, - state: *mut ffi::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) - -> AppLayerResult -{ +pub unsafe extern fn rs_smb_parse_request_tcp( + flow: *const Flow, state: *mut ffi::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { let state = cast_pointer!(state, SMBState); let flow = cast_pointer!(flow, Flow); @@ -1961,7 +2384,8 @@ pub unsafe extern "C" fn rs_smb_parse_request_tcp(flow: *const Flow, SCLogDebug!("parsing {} bytes of request data", stream_slice.len()); /* START with MISTREAM set: record might be starting the middle. */ - if stream_slice.flags() & (STREAM_START|STREAM_MIDSTREAM) == (STREAM_START|STREAM_MIDSTREAM) { + if stream_slice.flags() & (STREAM_START | STREAM_MIDSTREAM) == (STREAM_START | STREAM_MIDSTREAM) + { state.ts_gap = true; } @@ -1970,24 +2394,15 @@ pub unsafe extern "C" fn rs_smb_parse_request_tcp(flow: *const Flow, } #[no_mangle] -pub extern "C" fn rs_smb_parse_request_tcp_gap( - state: &mut SMBState, - input_len: u32) - -> AppLayerResult -{ +pub extern fn rs_smb_parse_request_tcp_gap(state: &mut SMBState, input_len: u32) -> AppLayerResult { state.parse_tcp_data_ts_gap(input_len) } - #[no_mangle] -pub unsafe extern "C" fn rs_smb_parse_response_tcp(flow: *const Flow, - state: *mut ffi::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const ffi::c_void, - ) - -> AppLayerResult -{ +pub unsafe extern fn rs_smb_parse_response_tcp( + flow: *const Flow, state: *mut ffi::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const ffi::c_void, +) -> AppLayerResult { let state = cast_pointer!(state, SMBState); let flow = cast_pointer!(flow, Flow); @@ -1996,7 +2411,8 @@ pub unsafe extern "C" fn rs_smb_parse_response_tcp(flow: *const Flow, } /* START with MISTREAM set: record might be starting the middle. */ - if stream_slice.flags() & (STREAM_START|STREAM_MIDSTREAM) == (STREAM_START|STREAM_MIDSTREAM) { + if stream_slice.flags() & (STREAM_START | STREAM_MIDSTREAM) == (STREAM_START | STREAM_MIDSTREAM) + { state.tc_gap = true; } @@ -2005,16 +2421,13 @@ pub unsafe extern "C" fn rs_smb_parse_response_tcp(flow: *const Flow, } #[no_mangle] -pub extern "C" fn rs_smb_parse_response_tcp_gap( - state: &mut SMBState, - input_len: u32) - -> AppLayerResult -{ +pub extern fn rs_smb_parse_response_tcp_gap( + state: &mut SMBState, input_len: u32, +) -> AppLayerResult { state.parse_tcp_data_tc_gap(input_len) } -fn smb_probe_tcp_midstream(direction: Direction, slice: &[u8], rdir: *mut u8, begins: bool) -> i8 -{ +fn smb_probe_tcp_midstream(direction: Direction, slice: &[u8], rdir: *mut u8, begins: bool) -> i8 { let r = if begins { // if pattern was found in the beginning, just check first byte if slice[0] == NBSS_MSGTYPE_SESSION_MESSAGE { @@ -2031,96 +2444,119 @@ fn smb_probe_tcp_midstream(direction: Direction, slice: &[u8], rdir: *mut u8, be match parse_smb_version(data) { Ok((_, ref smb)) => { SCLogDebug!("SMB {:?}", smb); - if smb.version == 0xff_u8 { // SMB1 + if smb.version == 0xff_u8 { + // SMB1 SCLogDebug!("SMBv1 record"); if let Ok((_, ref smb_record)) = parse_smb_record(data) { if smb_record.flags & 0x80 != 0 { SCLogDebug!("RESPONSE {:02x}", smb_record.flags); if direction == Direction::ToServer { - unsafe { *rdir = Direction::ToClient as u8; } + unsafe { + *rdir = Direction::ToClient as u8; + } } } else { SCLogDebug!("REQUEST {:02x}", smb_record.flags); if direction == Direction::ToClient { - unsafe { *rdir = Direction::ToServer as u8; } + unsafe { + *rdir = Direction::ToServer as u8; + } } } return 1; } - } else if smb.version == 0xfe_u8 { // SMB2 + } else if smb.version == 0xfe_u8 { + // SMB2 SCLogDebug!("SMB2 record"); if let Ok((_, ref smb_record)) = parse_smb2_record_direction(data) { if direction == Direction::ToServer { - SCLogDebug!("direction Direction::ToServer smb_record {:?}", smb_record); + SCLogDebug!( + "direction Direction::ToServer smb_record {:?}", + smb_record + ); if !smb_record.request { - unsafe { *rdir = Direction::ToClient as u8; } + unsafe { + *rdir = Direction::ToClient as u8; + } } } else { - SCLogDebug!("direction Direction::ToClient smb_record {:?}", smb_record); + SCLogDebug!( + "direction Direction::ToClient smb_record {:?}", + smb_record + ); if smb_record.request { - unsafe { *rdir = Direction::ToServer as u8; } + unsafe { + *rdir = Direction::ToServer as u8; + } } } } - } - else if smb.version == 0xfd_u8 { // SMB3 transform + } else if smb.version == 0xfd_u8 { + // SMB3 transform SCLogDebug!("SMB3 record"); } return 1; - }, - _ => { - SCLogDebug!("smb not found in {:?}", slice); - }, + } + _ => { + SCLogDebug!("smb not found in {:?}", slice); + } } - }, + } _ => { SCLogDebug!("no dice"); - }, + } } return 0; } -fn smb_probe_tcp(flags: u8, slice: &[u8], rdir: *mut u8, begins: bool) -> AppProto -{ - if flags & STREAM_MIDSTREAM == STREAM_MIDSTREAM && smb_probe_tcp_midstream(flags.into(), slice, rdir, begins) == 1 { - unsafe { return ALPROTO_SMB; } +fn smb_probe_tcp(flags: u8, slice: &[u8], rdir: *mut u8, begins: bool) -> AppProto { + if flags & STREAM_MIDSTREAM == STREAM_MIDSTREAM + && smb_probe_tcp_midstream(flags.into(), slice, rdir, begins) == 1 + { + unsafe { + return ALPROTO_SMB; + } } if let Ok((_, ref hdr)) = parse_nbss_record_partial(slice) { if hdr.is_smb() { SCLogDebug!("smb found"); - unsafe { return ALPROTO_SMB; } - } else if hdr.needs_more(){ + unsafe { + return ALPROTO_SMB; + } + } else if hdr.needs_more() { return 0; - } else if hdr.is_valid() && - hdr.message_type != NBSS_MSGTYPE_SESSION_MESSAGE { - //we accept a first small netbios message before real SMB - let hl = hdr.length as usize; - if hdr.data.len() >= hl + 8 { - // 8 is 4 bytes NBSS + 4 bytes SMB0xFX magic - if let Ok((_, ref hdr2)) = parse_nbss_record_partial(&hdr.data[hl..]) { - if hdr2.is_smb() { - SCLogDebug!("smb found"); - unsafe { return ALPROTO_SMB; } + } else if hdr.is_valid() && hdr.message_type != NBSS_MSGTYPE_SESSION_MESSAGE { + //we accept a first small netbios message before real SMB + let hl = hdr.length as usize; + if hdr.data.len() >= hl + 8 { + // 8 is 4 bytes NBSS + 4 bytes SMB0xFX magic + if let Ok((_, ref hdr2)) = parse_nbss_record_partial(&hdr.data[hl..]) { + if hdr2.is_smb() { + SCLogDebug!("smb found"); + unsafe { + return ALPROTO_SMB; } } - } else if hdr.length < 256 { - // we want more data, 256 is some random value - return 0; } - // default is failure + } else if hdr.length < 256 { + // we want more data, 256 is some random value + return 0; } + // default is failure + } } SCLogDebug!("no smb"); - unsafe { return ALPROTO_FAILED; } + unsafe { + return ALPROTO_FAILED; + } } // probing confirmation parser // return 1 if found, 0 is not found #[no_mangle] -pub unsafe extern "C" fn rs_smb_probe_begins_tcp(_f: *const Flow, - flags: u8, input: *const u8, len: u32, rdir: *mut u8) - -> AppProto -{ +pub unsafe extern fn rs_smb_probe_begins_tcp( + _f: *const Flow, flags: u8, input: *const u8, len: u32, rdir: *mut u8, +) -> AppProto { if len < MIN_REC_SIZE as u32 { return ALPROTO_UNKNOWN; } @@ -2131,10 +2567,9 @@ pub unsafe extern "C" fn rs_smb_probe_begins_tcp(_f: *const Flow, // probing parser // return 1 if found, 0 is not found #[no_mangle] -pub unsafe extern "C" fn rs_smb_probe_tcp(_f: *const Flow, - flags: u8, input: *const u8, len: u32, rdir: *mut u8) - -> AppProto -{ +pub unsafe extern fn rs_smb_probe_tcp( + _f: *const Flow, flags: u8, input: *const u8, len: u32, rdir: *mut u8, +) -> AppProto { if len < MIN_REC_SIZE as u32 { return ALPROTO_UNKNOWN; } @@ -2143,19 +2578,14 @@ pub unsafe extern "C" fn rs_smb_probe_tcp(_f: *const Flow, } #[no_mangle] -pub unsafe extern "C" fn rs_smb_state_get_tx_count(state: *mut ffi::c_void) - -> u64 -{ +pub unsafe extern fn rs_smb_state_get_tx_count(state: *mut ffi::c_void) -> u64 { let state = cast_pointer!(state, SMBState); SCLogDebug!("rs_smb_state_get_tx_count: returning {}", state.tx_id); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_smb_state_get_tx(state: *mut ffi::c_void, - tx_id: u64) - -> *mut ffi::c_void -{ +pub unsafe extern fn rs_smb_state_get_tx(state: *mut ffi::c_void, tx_id: u64) -> *mut ffi::c_void { let state = cast_pointer!(state, SMBState); match state.get_tx_by_id(tx_id) { Some(tx) => { @@ -2168,19 +2598,14 @@ pub unsafe extern "C" fn rs_smb_state_get_tx(state: *mut ffi::c_void, } #[no_mangle] -pub unsafe extern "C" fn rs_smb_state_tx_free(state: *mut ffi::c_void, - tx_id: u64) -{ +pub unsafe extern fn rs_smb_state_tx_free(state: *mut ffi::c_void, tx_id: u64) { let state = cast_pointer!(state, SMBState); SCLogDebug!("freeing tx {}", tx_id); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_smb_tx_get_alstate_progress(tx: *mut ffi::c_void, - direction: u8) - -> i32 -{ +pub unsafe extern fn rs_smb_tx_get_alstate_progress(tx: *mut ffi::c_void, direction: u8) -> i32 { let tx = cast_pointer!(tx, SMBTransaction); if direction == Direction::ToServer as u8 && tx.request_done { @@ -2190,29 +2615,26 @@ pub unsafe extern "C" fn rs_smb_tx_get_alstate_progress(tx: *mut ffi::c_void, SCLogDebug!("tx {} TOCLIENT progress 1 => {:?}", tx.id, tx); return 1; } else { - SCLogDebug!("tx {} direction {} progress 0 => {:?}", tx.id, direction, tx); + SCLogDebug!( + "tx {} direction {} progress 0 => {:?}", + tx.id, + direction, + tx + ); return 0; } } - export_state_data_get!(rs_smb_get_state_data, SMBState); #[no_mangle] -pub unsafe extern "C" fn rs_smb_get_tx_data( - tx: *mut std::os::raw::c_void) - -> *mut AppLayerTxData -{ +pub unsafe extern fn rs_smb_get_tx_data(tx: *mut std::os::raw::c_void) -> *mut AppLayerTxData { let tx = cast_pointer!(tx, SMBTransaction); return &mut tx.tx_data; } - #[no_mangle] -pub unsafe extern "C" fn rs_smb_state_truncate( - state: *mut std::ffi::c_void, - direction: u8) -{ +pub unsafe extern fn rs_smb_state_truncate(state: *mut std::ffi::c_void, direction: u8) { let state = cast_pointer!(state, SMBState); match direction.into() { Direction::ToServer => { @@ -2225,24 +2647,24 @@ pub unsafe extern "C" fn rs_smb_state_truncate( } #[no_mangle] -pub unsafe extern "C" fn rs_smb_state_get_event_info_by_id( - event_id: std::os::raw::c_int, - event_name: *mut *const std::os::raw::c_char, +pub unsafe extern fn rs_smb_state_get_event_info_by_id( + event_id: std::os::raw::c_int, event_name: *mut *const std::os::raw::c_char, event_type: *mut AppLayerEventType, ) -> i8 { SMBEvent::get_event_info_by_id(event_id, event_name, event_type) } #[no_mangle] -pub unsafe extern "C" fn rs_smb_state_get_event_info( - event_name: *const std::os::raw::c_char, - event_id: *mut std::os::raw::c_int, +pub unsafe extern fn rs_smb_state_get_event_info( + event_name: *const std::os::raw::c_char, event_id: *mut std::os::raw::c_int, event_type: *mut AppLayerEventType, ) -> std::os::raw::c_int { SMBEvent::get_event_info(event_name, event_id, event_type) } -pub unsafe extern "C" fn smb3_probe_tcp(f: *const Flow, dir: u8, input: *const u8, len: u32, rdir: *mut u8) -> u16 { +pub unsafe extern fn smb3_probe_tcp( + f: *const Flow, dir: u8, input: *const u8, len: u32, rdir: *mut u8, +) -> u16 { let retval = rs_smb_probe_tcp(f, dir, input, len, rdir); let f = cast_pointer!(f, Flow); if retval != ALPROTO_SMB { @@ -2250,8 +2672,16 @@ pub unsafe extern "C" fn smb3_probe_tcp(f: *const Flow, dir: u8, input: *const u } let (sp, dp) = f.get_ports(); let flags = f.get_flags(); - let fsp = if (flags & FLOW_DIR_REVERSED) != 0 { dp } else { sp }; - let fdp = if (flags & FLOW_DIR_REVERSED) != 0 { sp } else { dp }; + let fsp = if (flags & FLOW_DIR_REVERSED) != 0 { + dp + } else { + sp + }; + let fdp = if (flags & FLOW_DIR_REVERSED) != 0 { + sp + } else { + dp + }; if fsp == 445 && fdp != 445 { match dir.into() { Direction::ToServer => { @@ -2269,26 +2699,74 @@ fn register_pattern_probe() -> i8 { let mut r = 0; unsafe { // SMB1 - r |= AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_SMB, - b"|ff|SMB\0".as_ptr() as *const std::os::raw::c_char, 8, 4, - Direction::ToServer as u8, rs_smb_probe_begins_tcp, MIN_REC_SIZE, MIN_REC_SIZE); - r |= AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_SMB, - b"|ff|SMB\0".as_ptr() as *const std::os::raw::c_char, 8, 4, - Direction::ToClient as u8, rs_smb_probe_begins_tcp, MIN_REC_SIZE, MIN_REC_SIZE); + r |= AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_SMB, + b"|ff|SMB\0".as_ptr() as *const std::os::raw::c_char, + 8, + 4, + Direction::ToServer as u8, + rs_smb_probe_begins_tcp, + MIN_REC_SIZE, + MIN_REC_SIZE, + ); + r |= AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_SMB, + b"|ff|SMB\0".as_ptr() as *const std::os::raw::c_char, + 8, + 4, + Direction::ToClient as u8, + rs_smb_probe_begins_tcp, + MIN_REC_SIZE, + MIN_REC_SIZE, + ); // SMB2/3 - r |= AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_SMB, - b"|fe|SMB\0".as_ptr() as *const std::os::raw::c_char, 8, 4, - Direction::ToServer as u8, rs_smb_probe_begins_tcp, MIN_REC_SIZE, MIN_REC_SIZE); - r |= AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_SMB, - b"|fe|SMB\0".as_ptr() as *const std::os::raw::c_char, 8, 4, - Direction::ToClient as u8, rs_smb_probe_begins_tcp, MIN_REC_SIZE, MIN_REC_SIZE); + r |= AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_SMB, + b"|fe|SMB\0".as_ptr() as *const std::os::raw::c_char, + 8, + 4, + Direction::ToServer as u8, + rs_smb_probe_begins_tcp, + MIN_REC_SIZE, + MIN_REC_SIZE, + ); + r |= AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_SMB, + b"|fe|SMB\0".as_ptr() as *const std::os::raw::c_char, + 8, + 4, + Direction::ToClient as u8, + rs_smb_probe_begins_tcp, + MIN_REC_SIZE, + MIN_REC_SIZE, + ); // SMB3 encrypted records - r |= AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_SMB, - b"|fd|SMB\0".as_ptr() as *const std::os::raw::c_char, 8, 4, - Direction::ToServer as u8, smb3_probe_tcp, MIN_REC_SIZE, MIN_REC_SIZE); - r |= AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP, ALPROTO_SMB, - b"|fd|SMB\0".as_ptr() as *const std::os::raw::c_char, 8, 4, - Direction::ToClient as u8, smb3_probe_tcp, MIN_REC_SIZE, MIN_REC_SIZE); + r |= AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_SMB, + b"|fd|SMB\0".as_ptr() as *const std::os::raw::c_char, + 8, + 4, + Direction::ToServer as u8, + smb3_probe_tcp, + MIN_REC_SIZE, + MIN_REC_SIZE, + ); + r |= AppLayerProtoDetectPMRegisterPatternCSwPP( + IPPROTO_TCP, + ALPROTO_SMB, + b"|fd|SMB\0".as_ptr() as *const std::os::raw::c_char, + 8, + 4, + Direction::ToClient as u8, + smb3_probe_tcp, + MIN_REC_SIZE, + MIN_REC_SIZE, + ); } if r == 0 { @@ -2302,7 +2780,7 @@ fn register_pattern_probe() -> i8 { const PARSER_NAME: &[u8] = b"smb\0"; #[no_mangle] -pub unsafe extern "C" fn rs_smb_register_parser() { +pub unsafe extern fn rs_smb_register_parser() { let default_port = CString::new("445").unwrap(); let mut stream_depth = SMB_CONFIG_DEFAULT_STREAM_DEPTH; let parser = RustParser { @@ -2324,7 +2802,7 @@ pub unsafe extern "C" fn rs_smb_register_parser() { tx_comp_st_tc: 1, tx_get_progress: rs_smb_tx_get_alstate_progress, get_eventinfo: Some(rs_smb_state_get_event_info), - get_eventinfo_byid : Some(rs_smb_state_get_event_info_by_id), + get_eventinfo_byid: Some(rs_smb_state_get_event_info_by_id), localstorage_new: None, localstorage_free: None, get_tx_files: Some(rs_smb_gettxfiles), @@ -2340,82 +2818,117 @@ pub unsafe extern "C" fn rs_smb_register_parser() { let ip_proto_str = CString::new("tcp").unwrap(); - if AppLayerProtoDetectConfProtoDetectionEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_SMB = alproto; if register_pattern_probe() < 0 { return; } - let have_cfg = AppLayerProtoDetectPPParseConfPorts(ip_proto_str.as_ptr(), - IPPROTO_TCP, parser.name, ALPROTO_SMB, 0, - MIN_REC_SIZE, rs_smb_probe_tcp, rs_smb_probe_tcp); - - if have_cfg == 0 { - AppLayerProtoDetectPPRegister(IPPROTO_TCP, default_port.as_ptr(), ALPROTO_SMB, - 0, MIN_REC_SIZE, Direction::ToServer as u8, rs_smb_probe_tcp, rs_smb_probe_tcp); - } - - if AppLayerParserConfParserEnabled( + let have_cfg = AppLayerProtoDetectPPParseConfPorts( ip_proto_str.as_ptr(), + IPPROTO_TCP, parser.name, - ) != 0 - { + ALPROTO_SMB, + 0, + MIN_REC_SIZE, + rs_smb_probe_tcp, + rs_smb_probe_tcp, + ); + + if have_cfg == 0 { + AppLayerProtoDetectPPRegister( + IPPROTO_TCP, + default_port.as_ptr(), + ALPROTO_SMB, + 0, + MIN_REC_SIZE, + Direction::ToServer as u8, + rs_smb_probe_tcp, + rs_smb_probe_tcp, + ); + } + + if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust SMB parser registered."); let retval = conf_get("app-layer.protocols.smb.stream-depth"); if let Some(val) = retval { match get_memval(val) { - Ok(retval) => { stream_depth = retval as u32; } - Err(_) => { SCLogError!("Invalid depth value"); } + Ok(retval) => { + stream_depth = retval as u32; + } + Err(_) => { + SCLogError!("Invalid depth value"); + } } } AppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_SMB, stream_depth); let retval = conf_get("app-layer.protocols.smb.max-read-size"); if let Some(val) = retval { match get_memval(val) { - Ok(retval) => { SMB_CFG_MAX_READ_SIZE = retval as u32; } - Err(_) => { SCLogError!("Invalid max-read-size value"); } + Ok(retval) => { + SMB_CFG_MAX_READ_SIZE = retval as u32; + } + Err(_) => { + SCLogError!("Invalid max-read-size value"); + } } } let retval = conf_get("app-layer.protocols.smb.max-write-size"); if let Some(val) = retval { match get_memval(val) { - Ok(retval) => { SMB_CFG_MAX_WRITE_SIZE = retval as u32; } - Err(_) => { SCLogError!("Invalid max-write-size value"); } + Ok(retval) => { + SMB_CFG_MAX_WRITE_SIZE = retval as u32; + } + Err(_) => { + SCLogError!("Invalid max-write-size value"); + } } } let retval = conf_get("app-layer.protocols.smb.max-write-queue-size"); if let Some(val) = retval { match get_memval(val) { - Ok(retval) => { SMB_CFG_MAX_WRITE_QUEUE_SIZE = retval as u32; } - Err(_) => { SCLogError!("Invalid max-write-queue-size value"); } + Ok(retval) => { + SMB_CFG_MAX_WRITE_QUEUE_SIZE = retval as u32; + } + Err(_) => { + SCLogError!("Invalid max-write-queue-size value"); + } } } let retval = conf_get("app-layer.protocols.smb.max-write-queue-cnt"); if let Some(val) = retval { match get_memval(val) { - Ok(retval) => { SMB_CFG_MAX_WRITE_QUEUE_CNT = retval as u32; } - Err(_) => { SCLogError!("Invalid max-write-queue-cnt value"); } + Ok(retval) => { + SMB_CFG_MAX_WRITE_QUEUE_CNT = retval as u32; + } + Err(_) => { + SCLogError!("Invalid max-write-queue-cnt value"); + } } } let retval = conf_get("app-layer.protocols.smb.max-read-queue-size"); if let Some(val) = retval { match get_memval(val) { - Ok(retval) => { SMB_CFG_MAX_READ_QUEUE_SIZE = retval as u32; } - Err(_) => { SCLogError!("Invalid max-read-queue-size value"); } + Ok(retval) => { + SMB_CFG_MAX_READ_QUEUE_SIZE = retval as u32; + } + Err(_) => { + SCLogError!("Invalid max-read-queue-size value"); + } } } let retval = conf_get("app-layer.protocols.smb.max-read-queue-cnt"); if let Some(val) = retval { match get_memval(val) { - Ok(retval) => { SMB_CFG_MAX_READ_QUEUE_CNT = retval as u32; } - Err(_) => { SCLogError!("Invalid max-read-queue-cnt value"); } + Ok(retval) => { + SMB_CFG_MAX_READ_QUEUE_CNT = retval as u32; + } + Err(_) => { + SCLogError!("Invalid max-read-queue-cnt value"); + } } } if let Some(val) = conf_get("app-layer.protocols.smb.max-tx") { @@ -2425,10 +2938,18 @@ pub unsafe extern "C" fn rs_smb_register_parser() { SCLogError!("Invalid value for smb.max-tx"); } } - SCLogConfig!("read: max record size: {}, max queued chunks {}, max queued size {}", - SMB_CFG_MAX_READ_SIZE, SMB_CFG_MAX_READ_QUEUE_CNT, SMB_CFG_MAX_READ_QUEUE_SIZE); - SCLogConfig!("write: max record size: {}, max queued chunks {}, max queued size {}", - SMB_CFG_MAX_WRITE_SIZE, SMB_CFG_MAX_WRITE_QUEUE_CNT, SMB_CFG_MAX_WRITE_QUEUE_SIZE); + SCLogConfig!( + "read: max record size: {}, max queued chunks {}, max queued size {}", + SMB_CFG_MAX_READ_SIZE, + SMB_CFG_MAX_READ_QUEUE_CNT, + SMB_CFG_MAX_READ_QUEUE_SIZE + ); + SCLogConfig!( + "write: max record size: {}, max queued chunks {}, max queued size {}", + SMB_CFG_MAX_WRITE_SIZE, + SMB_CFG_MAX_WRITE_QUEUE_CNT, + SMB_CFG_MAX_WRITE_QUEUE_SIZE + ); } else { SCLogDebug!("Protocol detector and parser disabled for SMB."); } diff --git a/rust/src/smb/smb1.rs b/rust/src/smb/smb1.rs index 9d7d47e27c85..63ab45daac6f 100644 --- a/rust/src/smb/smb1.rs +++ b/rust/src/smb/smb1.rs @@ -21,10 +21,10 @@ use crate::core::*; -use crate::smb::smb::*; use crate::smb::dcerpc::*; use crate::smb::events::*; use crate::smb::files::*; +use crate::smb::smb::*; use crate::smb::smb1_records::*; use crate::smb::smb1_session::*; @@ -34,105 +34,108 @@ use crate::smb::smb_status::*; use nom7::Err; // https://msdn.microsoft.com/en-us/library/ee441741.aspx -pub const SMB1_COMMAND_CREATE_DIRECTORY: u8 = 0x00; -pub const SMB1_COMMAND_DELETE_DIRECTORY: u8 = 0x01; -pub const SMB1_COMMAND_OPEN: u8 = 0x02; -pub const SMB1_COMMAND_CREATE: u8 = 0x03; -pub const SMB1_COMMAND_CLOSE: u8 = 0x04; -pub const SMB1_COMMAND_FLUSH: u8 = 0x05; -pub const SMB1_COMMAND_DELETE: u8 = 0x06; -pub const SMB1_COMMAND_RENAME: u8 = 0x07; -pub const SMB1_COMMAND_QUERY_INFORMATION: u8 = 0x08; -pub const SMB1_COMMAND_SET_INFORMATION: u8 = 0x09; -pub const SMB1_COMMAND_READ: u8 = 0x0a; -pub const SMB1_COMMAND_WRITE: u8 = 0x0b; -pub const SMB1_COMMAND_LOCK_BYTE_RANGE: u8 = 0x0c; -pub const SMB1_COMMAND_UNLOCK_BYTE_RANGE: u8 = 0x0d; -pub const SMB1_COMMAND_CREATE_TEMPORARY: u8 = 0x0e; -pub const SMB1_COMMAND_CREATE_NEW: u8 = 0x0f; -pub const SMB1_COMMAND_CHECK_DIRECTORY: u8 = 0x10; -pub const SMB1_COMMAND_PROCESS_EXIT: u8 = 0x11; -pub const SMB1_COMMAND_SEEK: u8 = 0x12; -pub const SMB1_COMMAND_LOCK_AND_READ: u8 = 0x13; -pub const SMB1_COMMAND_WRITE_AND_UNLOCK: u8 = 0x14; -pub const SMB1_COMMAND_LOCKING_ANDX: u8 = 0x24; -pub const SMB1_COMMAND_TRANS: u8 = 0x25; -pub const SMB1_COMMAND_ECHO: u8 = 0x2b; -pub const SMB1_COMMAND_WRITE_AND_CLOSE: u8 = 0x2c; -pub const SMB1_COMMAND_OPEN_ANDX: u8 = 0x2d; -pub const SMB1_COMMAND_READ_ANDX: u8 = 0x2e; -pub const SMB1_COMMAND_WRITE_ANDX: u8 = 0x2f; -pub const SMB1_COMMAND_TRANS2: u8 = 0x32; -pub const SMB1_COMMAND_TRANS2_SECONDARY: u8 = 0x33; -pub const SMB1_COMMAND_FIND_CLOSE2: u8 = 0x34; -pub const SMB1_COMMAND_TREE_DISCONNECT: u8 = 0x71; -pub const SMB1_COMMAND_NEGOTIATE_PROTOCOL: u8 = 0x72; -pub const SMB1_COMMAND_SESSION_SETUP_ANDX: u8 = 0x73; -pub const SMB1_COMMAND_LOGOFF_ANDX: u8 = 0x74; -pub const SMB1_COMMAND_TREE_CONNECT_ANDX: u8 = 0x75; -pub const SMB1_COMMAND_QUERY_INFO_DISK: u8 = 0x80; -pub const SMB1_COMMAND_NT_TRANS: u8 = 0xa0; -pub const SMB1_COMMAND_NT_TRANS_SECONDARY: u8 = 0xa1; -pub const SMB1_COMMAND_NT_CREATE_ANDX: u8 = 0xa2; -pub const SMB1_COMMAND_NT_CANCEL: u8 = 0xa4; -pub const SMB1_COMMAND_NONE: u8 = 0xff; +pub const SMB1_COMMAND_CREATE_DIRECTORY: u8 = 0x00; +pub const SMB1_COMMAND_DELETE_DIRECTORY: u8 = 0x01; +pub const SMB1_COMMAND_OPEN: u8 = 0x02; +pub const SMB1_COMMAND_CREATE: u8 = 0x03; +pub const SMB1_COMMAND_CLOSE: u8 = 0x04; +pub const SMB1_COMMAND_FLUSH: u8 = 0x05; +pub const SMB1_COMMAND_DELETE: u8 = 0x06; +pub const SMB1_COMMAND_RENAME: u8 = 0x07; +pub const SMB1_COMMAND_QUERY_INFORMATION: u8 = 0x08; +pub const SMB1_COMMAND_SET_INFORMATION: u8 = 0x09; +pub const SMB1_COMMAND_READ: u8 = 0x0a; +pub const SMB1_COMMAND_WRITE: u8 = 0x0b; +pub const SMB1_COMMAND_LOCK_BYTE_RANGE: u8 = 0x0c; +pub const SMB1_COMMAND_UNLOCK_BYTE_RANGE: u8 = 0x0d; +pub const SMB1_COMMAND_CREATE_TEMPORARY: u8 = 0x0e; +pub const SMB1_COMMAND_CREATE_NEW: u8 = 0x0f; +pub const SMB1_COMMAND_CHECK_DIRECTORY: u8 = 0x10; +pub const SMB1_COMMAND_PROCESS_EXIT: u8 = 0x11; +pub const SMB1_COMMAND_SEEK: u8 = 0x12; +pub const SMB1_COMMAND_LOCK_AND_READ: u8 = 0x13; +pub const SMB1_COMMAND_WRITE_AND_UNLOCK: u8 = 0x14; +pub const SMB1_COMMAND_LOCKING_ANDX: u8 = 0x24; +pub const SMB1_COMMAND_TRANS: u8 = 0x25; +pub const SMB1_COMMAND_ECHO: u8 = 0x2b; +pub const SMB1_COMMAND_WRITE_AND_CLOSE: u8 = 0x2c; +pub const SMB1_COMMAND_OPEN_ANDX: u8 = 0x2d; +pub const SMB1_COMMAND_READ_ANDX: u8 = 0x2e; +pub const SMB1_COMMAND_WRITE_ANDX: u8 = 0x2f; +pub const SMB1_COMMAND_TRANS2: u8 = 0x32; +pub const SMB1_COMMAND_TRANS2_SECONDARY: u8 = 0x33; +pub const SMB1_COMMAND_FIND_CLOSE2: u8 = 0x34; +pub const SMB1_COMMAND_TREE_DISCONNECT: u8 = 0x71; +pub const SMB1_COMMAND_NEGOTIATE_PROTOCOL: u8 = 0x72; +pub const SMB1_COMMAND_SESSION_SETUP_ANDX: u8 = 0x73; +pub const SMB1_COMMAND_LOGOFF_ANDX: u8 = 0x74; +pub const SMB1_COMMAND_TREE_CONNECT_ANDX: u8 = 0x75; +pub const SMB1_COMMAND_QUERY_INFO_DISK: u8 = 0x80; +pub const SMB1_COMMAND_NT_TRANS: u8 = 0xa0; +pub const SMB1_COMMAND_NT_TRANS_SECONDARY: u8 = 0xa1; +pub const SMB1_COMMAND_NT_CREATE_ANDX: u8 = 0xa2; +pub const SMB1_COMMAND_NT_CANCEL: u8 = 0xa4; +pub const SMB1_COMMAND_NONE: u8 = 0xff; pub fn smb1_command_string(c: u8) -> String { match c { - SMB1_COMMAND_CREATE_DIRECTORY => "SMB1_COMMAND_CREATE_DIRECTORY", - SMB1_COMMAND_DELETE_DIRECTORY => "SMB1_COMMAND_DELETE_DIRECTORY", - SMB1_COMMAND_OPEN => "SMB1_COMMAND_OPEN", - SMB1_COMMAND_CREATE => "SMB1_COMMAND_CREATE", - SMB1_COMMAND_CLOSE => "SMB1_COMMAND_CLOSE", - SMB1_COMMAND_FLUSH => "SMB1_COMMAND_FLUSH", - SMB1_COMMAND_DELETE => "SMB1_COMMAND_DELETE", - SMB1_COMMAND_RENAME => "SMB1_COMMAND_RENAME", - SMB1_COMMAND_QUERY_INFORMATION => "SMB1_COMMAND_QUERY_INFORMATION", - SMB1_COMMAND_SET_INFORMATION => "SMB1_COMMAND_SET_INFORMATION", - SMB1_COMMAND_READ => "SMB1_COMMAND_READ", - SMB1_COMMAND_WRITE => "SMB1_COMMAND_WRITE", - SMB1_COMMAND_LOCK_BYTE_RANGE => "SMB1_COMMAND_LOCK_BYTE_RANGE", - SMB1_COMMAND_UNLOCK_BYTE_RANGE => "SMB1_COMMAND_UNLOCK_BYTE_RANGE", - SMB1_COMMAND_CREATE_TEMPORARY => "SMB1_COMMAND_CREATE_TEMPORARY", - SMB1_COMMAND_CREATE_NEW => "SMB1_COMMAND_CREATE_NEW", - SMB1_COMMAND_CHECK_DIRECTORY => "SMB1_COMMAND_CHECK_DIRECTORY", - SMB1_COMMAND_PROCESS_EXIT => "SMB1_COMMAND_PROCESS_EXIT", - SMB1_COMMAND_SEEK => "SMB1_COMMAND_SEEK", - SMB1_COMMAND_LOCK_AND_READ => "SMB1_COMMAND_LOCK_AND_READ", - SMB1_COMMAND_WRITE_AND_UNLOCK => "SMB1_COMMAND_WRITE_AND_UNLOCK", - SMB1_COMMAND_LOCKING_ANDX => "SMB1_COMMAND_LOCKING_ANDX", - SMB1_COMMAND_ECHO => "SMB1_COMMAND_ECHO", - SMB1_COMMAND_WRITE_AND_CLOSE => "SMB1_COMMAND_WRITE_AND_CLOSE", - SMB1_COMMAND_OPEN_ANDX => "SMB1_COMMAND_OPEN_ANDX", - SMB1_COMMAND_READ_ANDX => "SMB1_COMMAND_READ_ANDX", - SMB1_COMMAND_WRITE_ANDX => "SMB1_COMMAND_WRITE_ANDX", - SMB1_COMMAND_TRANS => "SMB1_COMMAND_TRANS", - SMB1_COMMAND_TRANS2 => "SMB1_COMMAND_TRANS2", - SMB1_COMMAND_TRANS2_SECONDARY => "SMB1_COMMAND_TRANS2_SECONDARY", - SMB1_COMMAND_FIND_CLOSE2 => "SMB1_COMMAND_FIND_CLOSE2", - SMB1_COMMAND_TREE_DISCONNECT => "SMB1_COMMAND_TREE_DISCONNECT", + SMB1_COMMAND_CREATE_DIRECTORY => "SMB1_COMMAND_CREATE_DIRECTORY", + SMB1_COMMAND_DELETE_DIRECTORY => "SMB1_COMMAND_DELETE_DIRECTORY", + SMB1_COMMAND_OPEN => "SMB1_COMMAND_OPEN", + SMB1_COMMAND_CREATE => "SMB1_COMMAND_CREATE", + SMB1_COMMAND_CLOSE => "SMB1_COMMAND_CLOSE", + SMB1_COMMAND_FLUSH => "SMB1_COMMAND_FLUSH", + SMB1_COMMAND_DELETE => "SMB1_COMMAND_DELETE", + SMB1_COMMAND_RENAME => "SMB1_COMMAND_RENAME", + SMB1_COMMAND_QUERY_INFORMATION => "SMB1_COMMAND_QUERY_INFORMATION", + SMB1_COMMAND_SET_INFORMATION => "SMB1_COMMAND_SET_INFORMATION", + SMB1_COMMAND_READ => "SMB1_COMMAND_READ", + SMB1_COMMAND_WRITE => "SMB1_COMMAND_WRITE", + SMB1_COMMAND_LOCK_BYTE_RANGE => "SMB1_COMMAND_LOCK_BYTE_RANGE", + SMB1_COMMAND_UNLOCK_BYTE_RANGE => "SMB1_COMMAND_UNLOCK_BYTE_RANGE", + SMB1_COMMAND_CREATE_TEMPORARY => "SMB1_COMMAND_CREATE_TEMPORARY", + SMB1_COMMAND_CREATE_NEW => "SMB1_COMMAND_CREATE_NEW", + SMB1_COMMAND_CHECK_DIRECTORY => "SMB1_COMMAND_CHECK_DIRECTORY", + SMB1_COMMAND_PROCESS_EXIT => "SMB1_COMMAND_PROCESS_EXIT", + SMB1_COMMAND_SEEK => "SMB1_COMMAND_SEEK", + SMB1_COMMAND_LOCK_AND_READ => "SMB1_COMMAND_LOCK_AND_READ", + SMB1_COMMAND_WRITE_AND_UNLOCK => "SMB1_COMMAND_WRITE_AND_UNLOCK", + SMB1_COMMAND_LOCKING_ANDX => "SMB1_COMMAND_LOCKING_ANDX", + SMB1_COMMAND_ECHO => "SMB1_COMMAND_ECHO", + SMB1_COMMAND_WRITE_AND_CLOSE => "SMB1_COMMAND_WRITE_AND_CLOSE", + SMB1_COMMAND_OPEN_ANDX => "SMB1_COMMAND_OPEN_ANDX", + SMB1_COMMAND_READ_ANDX => "SMB1_COMMAND_READ_ANDX", + SMB1_COMMAND_WRITE_ANDX => "SMB1_COMMAND_WRITE_ANDX", + SMB1_COMMAND_TRANS => "SMB1_COMMAND_TRANS", + SMB1_COMMAND_TRANS2 => "SMB1_COMMAND_TRANS2", + SMB1_COMMAND_TRANS2_SECONDARY => "SMB1_COMMAND_TRANS2_SECONDARY", + SMB1_COMMAND_FIND_CLOSE2 => "SMB1_COMMAND_FIND_CLOSE2", + SMB1_COMMAND_TREE_DISCONNECT => "SMB1_COMMAND_TREE_DISCONNECT", SMB1_COMMAND_NEGOTIATE_PROTOCOL => "SMB1_COMMAND_NEGOTIATE_PROTOCOL", SMB1_COMMAND_SESSION_SETUP_ANDX => "SMB1_COMMAND_SESSION_SETUP_ANDX", - SMB1_COMMAND_LOGOFF_ANDX => "SMB1_COMMAND_LOGOFF_ANDX", - SMB1_COMMAND_TREE_CONNECT_ANDX => "SMB1_COMMAND_TREE_CONNECT_ANDX", - SMB1_COMMAND_QUERY_INFO_DISK => "SMB1_COMMAND_QUERY_INFO_DISK", - SMB1_COMMAND_NT_TRANS => "SMB1_COMMAND_NT_TRANS", + SMB1_COMMAND_LOGOFF_ANDX => "SMB1_COMMAND_LOGOFF_ANDX", + SMB1_COMMAND_TREE_CONNECT_ANDX => "SMB1_COMMAND_TREE_CONNECT_ANDX", + SMB1_COMMAND_QUERY_INFO_DISK => "SMB1_COMMAND_QUERY_INFO_DISK", + SMB1_COMMAND_NT_TRANS => "SMB1_COMMAND_NT_TRANS", SMB1_COMMAND_NT_TRANS_SECONDARY => "SMB1_COMMAND_NT_TRANS_SECONDARY", - SMB1_COMMAND_NT_CREATE_ANDX => "SMB1_COMMAND_NT_CREATE_ANDX", - SMB1_COMMAND_NT_CANCEL => "SMB1_COMMAND_NT_CANCEL", - _ => { return (c).to_string(); }, - }.to_string() + SMB1_COMMAND_NT_CREATE_ANDX => "SMB1_COMMAND_NT_CREATE_ANDX", + SMB1_COMMAND_NT_CANCEL => "SMB1_COMMAND_NT_CANCEL", + _ => { + return (c).to_string(); + } + } + .to_string() } // later we'll use this to determine if we need to // track a ssn per type pub fn smb1_create_new_tx(cmd: u8) -> bool { match cmd { - SMB1_COMMAND_READ_ANDX | - SMB1_COMMAND_WRITE_ANDX | - SMB1_COMMAND_TRANS | - SMB1_COMMAND_TRANS2 => { false }, - _ => { true }, + SMB1_COMMAND_READ_ANDX + | SMB1_COMMAND_WRITE_ANDX + | SMB1_COMMAND_TRANS + | SMB1_COMMAND_TRANS2 => false, + _ => true, } } @@ -141,15 +144,12 @@ pub fn smb1_create_new_tx(cmd: u8) -> bool { // excludes the 'maybe' commands like TRANS2 pub fn smb1_check_tx(cmd: u8) -> bool { match cmd { - SMB1_COMMAND_READ_ANDX | - SMB1_COMMAND_WRITE_ANDX | - SMB1_COMMAND_TRANS => { false }, - _ => { true }, + SMB1_COMMAND_READ_ANDX | SMB1_COMMAND_WRITE_ANDX | SMB1_COMMAND_TRANS => false, + _ => true, } } -fn smb1_close_file(state: &mut SMBState, fid: &[u8], direction: Direction) -{ +fn smb1_close_file(state: &mut SMBState, fid: &[u8], direction: Direction) { if let Some(tx) = state.get_file_tx_by_fuid(fid, direction) { SCLogDebug!("found tx {}", tx.id); if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { @@ -166,14 +166,14 @@ fn smb1_close_file(state: &mut SMBState, fid: &[u8], direction: Direction) fn smb1_command_is_andx(c: u8) -> bool { match c { - SMB1_COMMAND_LOCKING_ANDX | - SMB1_COMMAND_OPEN_ANDX | - SMB1_COMMAND_READ_ANDX | - SMB1_COMMAND_SESSION_SETUP_ANDX | - SMB1_COMMAND_LOGOFF_ANDX | - SMB1_COMMAND_TREE_CONNECT_ANDX | - SMB1_COMMAND_NT_CREATE_ANDX | - SMB1_COMMAND_WRITE_ANDX => { + SMB1_COMMAND_LOCKING_ANDX + | SMB1_COMMAND_OPEN_ANDX + | SMB1_COMMAND_READ_ANDX + | SMB1_COMMAND_SESSION_SETUP_ANDX + | SMB1_COMMAND_LOGOFF_ANDX + | SMB1_COMMAND_TREE_CONNECT_ANDX + | SMB1_COMMAND_NT_CREATE_ANDX + | SMB1_COMMAND_WRITE_ANDX => { return true; } _ => { @@ -182,32 +182,32 @@ fn smb1_command_is_andx(c: u8) -> bool { } } -fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, andx_offset: &mut usize) { - let mut events : Vec = Vec::new(); +fn smb1_request_record_one( + state: &mut SMBState, r: &SmbRecord, command: u8, andx_offset: &mut usize, +) { + let mut events: Vec = Vec::new(); let mut no_response_expected = false; let have_tx = match command { - SMB1_COMMAND_RENAME => { - match parse_smb_rename_request_record(r.data) { - Ok((_, rd)) => { - SCLogDebug!("RENAME {:?}", rd); + SMB1_COMMAND_RENAME => match parse_smb_rename_request_record(r.data) { + Ok((_, rd)) => { + SCLogDebug!("RENAME {:?}", rd); - let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); - let mut newname = rd.newname; - newname.retain(|&i|i != 0x00); - let mut oldname = rd.oldname; - oldname.retain(|&i|i != 0x00); + let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); + let mut newname = rd.newname; + newname.retain(|&i| i != 0x00); + let mut oldname = rd.oldname; + oldname.retain(|&i| i != 0x00); - let tx = state.new_rename_tx(Vec::new(), oldname, newname); - tx.hdr = tx_hdr; - tx.request_done = true; - tx.vercmd.set_smb1_cmd(SMB1_COMMAND_RENAME); - true - }, - _ => { - events.push(SMBEvent::MalformedData); - false - }, + let tx = state.new_rename_tx(Vec::new(), oldname, newname); + tx.hdr = tx_hdr; + tx.request_done = true; + tx.vercmd.set_smb1_cmd(SMB1_COMMAND_RENAME); + true + } + _ => { + events.push(SMBEvent::MalformedData); + false } }, SMB1_COMMAND_TRANS2 => { @@ -221,75 +221,97 @@ fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, and Ok((_, pd)) => { SCLogDebug!("TRANS2 SET_PATH_INFO PARAMS DONE {:?}", pd); - if pd.loi == 1013 { // set disposition info - match parse_trans2_request_data_set_file_info_disposition(rd.data_blob) { + if pd.loi == 1013 { + // set disposition info + match parse_trans2_request_data_set_file_info_disposition( + rd.data_blob, + ) { Ok((_, disp)) => { - SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION DONE {:?}", disp); - let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); - - let tx = state.new_setpathinfo_tx(pd.oldname, - rd.subcmd, pd.loi, disp.delete); + SCLogDebug!( + "TRANS2 SET_FILE_INFO DATA DISPOSITION DONE {:?}", + disp + ); + let tx_hdr = + SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); + + let tx = state.new_setpathinfo_tx( + pd.oldname, + rd.subcmd, + pd.loi, + disp.delete, + ); tx.hdr = tx_hdr; tx.request_done = true; tx.vercmd.set_smb1_cmd(SMB1_COMMAND_TRANS2); true - - }, + } Err(Err::Incomplete(_n)) => { SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION INCOMPLETE {:?}", _n); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { - SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", _e); + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { + SCLogDebug!( + "TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", + _e + ); events.push(SMBEvent::MalformedData); false - }, + } } } else if pd.loi == 1010 { - match parse_trans2_request_data_set_path_info_rename(rd.data_blob) { + match parse_trans2_request_data_set_path_info_rename( + rd.data_blob, + ) { Ok((_, ren)) => { - SCLogDebug!("TRANS2 SET_PATH_INFO DATA RENAME DONE {:?}", ren); - let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); + SCLogDebug!( + "TRANS2 SET_PATH_INFO DATA RENAME DONE {:?}", + ren + ); + let tx_hdr = + SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); let mut newname = ren.newname.to_vec(); - newname.retain(|&i|i != 0x00); + newname.retain(|&i| i != 0x00); - let fid : Vec = Vec::new(); + let fid: Vec = Vec::new(); let tx = state.new_rename_tx(fid, pd.oldname, newname); tx.hdr = tx_hdr; tx.request_done = true; tx.vercmd.set_smb1_cmd(SMB1_COMMAND_TRANS2); true - }, + } Err(Err::Incomplete(_n)) => { - SCLogDebug!("TRANS2 SET_PATH_INFO DATA RENAME INCOMPLETE {:?}", _n); + SCLogDebug!( + "TRANS2 SET_PATH_INFO DATA RENAME INCOMPLETE {:?}", + _n + ); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { - SCLogDebug!("TRANS2 SET_PATH_INFO DATA RENAME ERROR {:?}", _e); + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { + SCLogDebug!( + "TRANS2 SET_PATH_INFO DATA RENAME ERROR {:?}", + _e + ); events.push(SMBEvent::MalformedData); false - }, + } } } else { false } - }, + } Err(Err::Incomplete(_n)) => { SCLogDebug!("TRANS2 SET_PATH_INFO PARAMS INCOMPLETE {:?}", _n); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { SCLogDebug!("TRANS2 SET_PATH_INFO PARAMS ERROR {:?}", _e); events.push(SMBEvent::MalformedData); false - }, + } } } else if rd.subcmd == 8 { SCLogDebug!("SET_FILE_INFO"); @@ -297,107 +319,135 @@ fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, and Ok((_, pd)) => { SCLogDebug!("TRANS2 SET_FILE_INFO PARAMS DONE {:?}", pd); - if pd.loi == 1013 { // set disposition info - match parse_trans2_request_data_set_file_info_disposition(rd.data_blob) { + if pd.loi == 1013 { + // set disposition info + match parse_trans2_request_data_set_file_info_disposition( + rd.data_blob, + ) { Ok((_, disp)) => { - SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION DONE {:?}", disp); - let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); + SCLogDebug!( + "TRANS2 SET_FILE_INFO DATA DISPOSITION DONE {:?}", + disp + ); + let tx_hdr = + SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); let mut frankenfid = pd.fid.to_vec(); frankenfid.extend_from_slice(&u32_as_bytes(r.ssn_id)); - let filename = match state.guid2name_map.get(&frankenfid) { - Some(n) => n.to_vec(), - None => b"".to_vec(), - }; - let tx = state.new_setfileinfo_tx(filename, pd.fid.to_vec(), - rd.subcmd, pd.loi, disp.delete); + let filename = + match state.guid2name_map.get(&frankenfid) { + Some(n) => n.to_vec(), + None => b"".to_vec(), + }; + let tx = state.new_setfileinfo_tx( + filename, + pd.fid.to_vec(), + rd.subcmd, + pd.loi, + disp.delete, + ); tx.hdr = tx_hdr; tx.request_done = true; tx.vercmd.set_smb1_cmd(SMB1_COMMAND_TRANS2); true - - }, + } Err(Err::Incomplete(_n)) => { SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION INCOMPLETE {:?}", _n); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { - SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", _e); + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { + SCLogDebug!( + "TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", + _e + ); events.push(SMBEvent::MalformedData); false - }, + } } } else if pd.loi == 1010 { - match parse_trans2_request_data_set_file_info_rename(rd.data_blob) { + match parse_trans2_request_data_set_file_info_rename( + rd.data_blob, + ) { Ok((_, ren)) => { - SCLogDebug!("TRANS2 SET_FILE_INFO DATA RENAME DONE {:?}", ren); - let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); + SCLogDebug!( + "TRANS2 SET_FILE_INFO DATA RENAME DONE {:?}", + ren + ); + let tx_hdr = + SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); let mut newname = ren.newname.to_vec(); - newname.retain(|&i|i != 0x00); + newname.retain(|&i| i != 0x00); let mut frankenfid = pd.fid.to_vec(); frankenfid.extend_from_slice(&u32_as_bytes(r.ssn_id)); - let oldname = match state.guid2name_map.get(&frankenfid) { + let oldname = match state.guid2name_map.get(&frankenfid) + { Some(n) => n.to_vec(), None => b"".to_vec(), }; - let tx = state.new_rename_tx(pd.fid.to_vec(), oldname, newname); + let tx = state.new_rename_tx( + pd.fid.to_vec(), + oldname, + newname, + ); tx.hdr = tx_hdr; tx.request_done = true; tx.vercmd.set_smb1_cmd(SMB1_COMMAND_TRANS2); true - }, + } Err(Err::Incomplete(_n)) => { - SCLogDebug!("TRANS2 SET_FILE_INFO DATA RENAME INCOMPLETE {:?}", _n); + SCLogDebug!( + "TRANS2 SET_FILE_INFO DATA RENAME INCOMPLETE {:?}", + _n + ); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { - SCLogDebug!("TRANS2 SET_FILE_INFO DATA RENAME ERROR {:?}", _e); + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { + SCLogDebug!( + "TRANS2 SET_FILE_INFO DATA RENAME ERROR {:?}", + _e + ); events.push(SMBEvent::MalformedData); false - }, + } } } else { false } - }, + } Err(Err::Incomplete(_n)) => { SCLogDebug!("TRANS2 SET_FILE_INFO PARAMS INCOMPLETE {:?}", _n); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { SCLogDebug!("TRANS2 SET_FILE_INFO PARAMS ERROR {:?}", _e); events.push(SMBEvent::MalformedData); false - }, + } } } else { false } - }, + } Err(Err::Incomplete(_n)) => { SCLogDebug!("TRANS2 INCOMPLETE {:?}", _n); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { SCLogDebug!("TRANS2 ERROR {:?}", _e); events.push(SMBEvent::MalformedData); false - }, + } } - }, + } SMB1_COMMAND_READ_ANDX => { - match parse_smb_read_andx_request_record(&r.data[*andx_offset-SMB1_HEADER_SIZE..]) { + match parse_smb_read_andx_request_record(&r.data[*andx_offset - SMB1_HEADER_SIZE..]) { Ok((_, rr)) => { SCLogDebug!("rr {:?}", rr); @@ -407,70 +457,69 @@ fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, and fid.extend_from_slice(&u32_as_bytes(r.ssn_id)); let fidoff = SMBFileGUIDOffset::new(fid, rr.offset); state.ssn2vecoffset_map.insert(fid_key, fidoff); - }, + } _ => { events.push(SMBEvent::MalformedData); - }, + } } false - }, - SMB1_COMMAND_WRITE_ANDX | - SMB1_COMMAND_WRITE | - SMB1_COMMAND_WRITE_AND_CLOSE => { + } + SMB1_COMMAND_WRITE_ANDX | SMB1_COMMAND_WRITE | SMB1_COMMAND_WRITE_AND_CLOSE => { smb1_write_request_record(state, r, *andx_offset, command, 0); true // tx handling in func - }, + } SMB1_COMMAND_TRANS => { smb1_trans_request_record(state, r); true - }, - SMB1_COMMAND_NEGOTIATE_PROTOCOL => { - match parse_smb1_negotiate_protocol_record(r.data) { - Ok((_, pr)) => { - SCLogDebug!("SMB_COMMAND_NEGOTIATE_PROTOCOL {:?}", pr); - - let mut bad_dialects = false; - let mut dialects : Vec> = Vec::new(); - for d in &pr.dialects { - if d.is_empty() { - bad_dialects = true; - continue; - } else if d.len() == 1 { - bad_dialects = true; - } - let x = &d[1..d.len()]; - let dvec = x.to_vec(); - dialects.push(dvec); + } + SMB1_COMMAND_NEGOTIATE_PROTOCOL => match parse_smb1_negotiate_protocol_record(r.data) { + Ok((_, pr)) => { + SCLogDebug!("SMB_COMMAND_NEGOTIATE_PROTOCOL {:?}", pr); + + let mut bad_dialects = false; + let mut dialects: Vec> = Vec::new(); + for d in &pr.dialects { + if d.is_empty() { + bad_dialects = true; + continue; + } else if d.len() == 1 { + bad_dialects = true; } + let x = &d[1..d.len()]; + let dvec = x.to_vec(); + dialects.push(dvec); + } - let found = match state.get_negotiate_tx(1) { - Some(tx) => { - SCLogDebug!("WEIRD, should not have NEGOTIATE tx!"); - tx.set_event(SMBEvent::DuplicateNegotiate); - true - }, - None => { false }, - }; - if !found { - let tx = state.new_negotiate_tx(1); - if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = tx.type_data { - tdn.dialects = dialects; - } - tx.request_done = true; - if bad_dialects { - tx.set_event(SMBEvent::NegotiateMalformedDialects); - } + let found = match state.get_negotiate_tx(1) { + Some(tx) => { + SCLogDebug!("WEIRD, should not have NEGOTIATE tx!"); + tx.set_event(SMBEvent::DuplicateNegotiate); + true } - true - }, - _ => { - events.push(SMBEvent::MalformedData); - false - }, + None => false, + }; + if !found { + let tx = state.new_negotiate_tx(1); + if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = tx.type_data { + tdn.dialects = dialects; + } + tx.request_done = true; + if bad_dialects { + tx.set_event(SMBEvent::NegotiateMalformedDialects); + } + } + true + } + _ => { + events.push(SMBEvent::MalformedData); + false } }, SMB1_COMMAND_NT_CREATE_ANDX => { - match parse_smb_create_andx_request_record(&r.data[*andx_offset-SMB1_HEADER_SIZE..], r) { + match parse_smb_create_andx_request_record( + &r.data[*andx_offset - SMB1_HEADER_SIZE..], + r, + ) { Ok((_, cr)) => { SCLogDebug!("Create AndX {:?}", cr); let del = cr.create_options & 0x0000_1000 != 0; @@ -482,26 +531,32 @@ fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, and state.ssn2vec_map.insert(name_key, name_val); let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); - let tx = state.new_create_tx(&cr.file_name.to_vec(), - cr.disposition, del, dir, tx_hdr); + let tx = state.new_create_tx( + &cr.file_name.to_vec(), + cr.disposition, + del, + dir, + tx_hdr, + ); tx.vercmd.set_smb1_cmd(command); SCLogDebug!("TS CREATE TX {} created", tx.id); true - }, + } _ => { events.push(SMBEvent::MalformedData); false - }, + } } - }, + } SMB1_COMMAND_SESSION_SETUP_ANDX => { SCLogDebug!("SMB1_COMMAND_SESSION_SETUP_ANDX user_id {}", r.user_id); smb1_session_setup_request(state, r, *andx_offset); true - }, + } SMB1_COMMAND_TREE_CONNECT_ANDX => { SCLogDebug!("SMB1_COMMAND_TREE_CONNECT_ANDX"); - match parse_smb_connect_tree_andx_record(&r.data[*andx_offset-SMB1_HEADER_SIZE..], r) { + match parse_smb_connect_tree_andx_record(&r.data[*andx_offset - SMB1_HEADER_SIZE..], r) + { Ok((_, tr)) => { let name_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_TREE); let mut name_val = tr.path; @@ -518,61 +573,70 @@ fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, and tx.request_done = true; tx.vercmd.set_smb1_cmd(SMB1_COMMAND_TREE_CONNECT_ANDX); true - }, + } _ => { events.push(SMBEvent::MalformedData); false - }, + } } - }, + } SMB1_COMMAND_TREE_DISCONNECT => { let tree_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_SHARE); state.ssn2tree_map.remove(&tree_key); false - }, + } SMB1_COMMAND_CLOSE => { match parse_smb1_close_request_record(r.data) { Ok((_, cd)) => { let mut fid = cd.fid.to_vec(); fid.extend_from_slice(&u32_as_bytes(r.ssn_id)); - state.ssn2vec_map.insert(SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID), fid.to_vec()); + state + .ssn2vec_map + .insert(SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID), fid.to_vec()); SCLogDebug!("closing FID {:?}/{:?}", cd.fid, fid); smb1_close_file(state, &fid, Direction::ToServer); - }, + } _ => { events.push(SMBEvent::MalformedData); - }, + } } false - }, - SMB1_COMMAND_NT_CANCEL | - SMB1_COMMAND_TRANS2_SECONDARY | - SMB1_COMMAND_LOCKING_ANDX => { + } + SMB1_COMMAND_NT_CANCEL | SMB1_COMMAND_TRANS2_SECONDARY | SMB1_COMMAND_LOCKING_ANDX => { no_response_expected = true; false - }, + } _ => { - if command == SMB1_COMMAND_LOGOFF_ANDX || - command == SMB1_COMMAND_TREE_DISCONNECT || - command == SMB1_COMMAND_NT_TRANS || - command == SMB1_COMMAND_NT_TRANS_SECONDARY || - command == SMB1_COMMAND_NT_CANCEL || - command == SMB1_COMMAND_RENAME || - command == SMB1_COMMAND_CHECK_DIRECTORY || - command == SMB1_COMMAND_ECHO || - command == SMB1_COMMAND_TRANS - { } else { - SCLogDebug!("unsupported command {}/{}", - command, &smb1_command_string(command)); + if command == SMB1_COMMAND_LOGOFF_ANDX + || command == SMB1_COMMAND_TREE_DISCONNECT + || command == SMB1_COMMAND_NT_TRANS + || command == SMB1_COMMAND_NT_TRANS_SECONDARY + || command == SMB1_COMMAND_NT_CANCEL + || command == SMB1_COMMAND_RENAME + || command == SMB1_COMMAND_CHECK_DIRECTORY + || command == SMB1_COMMAND_ECHO + || command == SMB1_COMMAND_TRANS + { + } else { + SCLogDebug!( + "unsupported command {}/{}", + command, + &smb1_command_string(command) + ); } false - }, + } }; if !have_tx && smb1_create_new_tx(command) { let tx_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); let tx = state.new_generic_tx(1, command as u16, tx_key); - SCLogDebug!("tx {} created for {}/{}", tx.id, command, &smb1_command_string(command)); + SCLogDebug!( + "tx {} created for {}/{}", + tx.id, + command, + &smb1_command_string(command) + ); tx.set_events(events); if no_response_expected { tx.response_done = true; @@ -590,10 +654,13 @@ pub fn smb1_request_record(state: &mut SMBState, r: &SmbRecord) -> u32 { // continue for next andx command if any if smb1_command_is_andx(command) { - if let Ok((_, andx_hdr)) = smb1_parse_andx_header(&r.data[andx_offset-SMB1_HEADER_SIZE..]) { - if (andx_hdr.andx_offset as usize) > andx_offset && - andx_hdr.andx_command != SMB1_COMMAND_NONE && - (andx_hdr.andx_offset as usize) - SMB1_HEADER_SIZE < r.data.len() { + if let Ok((_, andx_hdr)) = + smb1_parse_andx_header(&r.data[andx_offset - SMB1_HEADER_SIZE..]) + { + if (andx_hdr.andx_offset as usize) > andx_offset + && andx_hdr.andx_command != SMB1_COMMAND_NONE + && (andx_hdr.andx_offset as usize) - SMB1_HEADER_SIZE < r.data.len() + { andx_offset = andx_hdr.andx_offset as usize; command = andx_hdr.andx_command; continue; @@ -606,20 +673,27 @@ pub fn smb1_request_record(state: &mut SMBState, r: &SmbRecord) -> u32 { 0 } -fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, andx_offset: &mut usize) { - SCLogDebug!("record: command {} status {} -> {:?}", r.command, r.nt_status, r); +fn smb1_response_record_one( + state: &mut SMBState, r: &SmbRecord, command: u8, andx_offset: &mut usize, +) { + SCLogDebug!( + "record: command {} status {} -> {:?}", + r.command, + r.nt_status, + r + ); let key_ssn_id = r.ssn_id; let key_tree_id = r.tree_id; let key_multiplex_id = r.multiplex_id; let mut tx_sync = false; - let mut events : Vec = Vec::new(); + let mut events: Vec = Vec::new(); let have_tx = match command { SMB1_COMMAND_READ_ANDX => { smb1_read_response_record(state, r, *andx_offset, 0); true // tx handling in func - }, + } SMB1_COMMAND_NEGOTIATE_PROTOCOL => { SCLogDebug!("SMB1_COMMAND_NEGOTIATE_PROTOCOL response"); match parse_smb1_negotiate_protocol_response_record(r.data) { @@ -640,28 +714,28 @@ fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, an let d = x.dialects[dialect_idx].to_vec(); Some(d) } - }, - _ => { None }, + } + _ => None, }; if d.is_none() { tx.set_event(SMBEvent::NegotiateMalformedDialects); } (true, d) - }, - None => { (false, None) }, + } + None => (false, None), }; if let Some(d) = dialect { SCLogDebug!("dialect {:?}", d); state.dialect_vec = Some(d); } have_ntx - }, + } _ => { events.push(SMBEvent::MalformedData); false - }, + } } - }, + } SMB1_COMMAND_TREE_CONNECT_ANDX => { if r.nt_status != SMB_NTSTATUS_SUCCESS { let name_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_TREE); @@ -676,14 +750,18 @@ fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, an return; } - match parse_smb_connect_tree_andx_response_record(&r.data[*andx_offset-SMB1_HEADER_SIZE..]) { + match parse_smb_connect_tree_andx_response_record( + &r.data[*andx_offset - SMB1_HEADER_SIZE..], + ) { Ok((_, tr)) => { let name_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_TREE); let is_pipe = tr.service == "IPC".as_bytes(); let mut share_name = Vec::new(); let found = match state.get_treeconnect_tx(name_key) { Some(tx) => { - if let Some(SMBTransactionTypeData::TREECONNECT(ref mut tdn)) = tx.type_data { + if let Some(SMBTransactionTypeData::TREECONNECT(ref mut tdn)) = + tx.type_data + { tdn.is_pipe = is_pipe; tdn.tree_id = r.tree_id as u32; share_name = tdn.share_name.to_vec(); @@ -694,8 +772,8 @@ fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, an tx.response_done = true; SCLogDebug!("tx {} is done", tx.id); true - }, - None => { false }, + } + None => false, }; if found { let tree = SMBTree::new(share_name.to_vec(), is_pipe); @@ -703,51 +781,58 @@ fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, an state.ssn2tree_map.insert(tree_key, tree); } found - }, + } _ => { events.push(SMBEvent::MalformedData); false - }, + } } - }, + } SMB1_COMMAND_TREE_DISCONNECT => { // normally removed when processing request, // but in case we missed that try again here let tree_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_SHARE); state.ssn2tree_map.remove(&tree_key); false - }, + } SMB1_COMMAND_NT_CREATE_ANDX => { SCLogDebug!("SMB1_COMMAND_NT_CREATE_ANDX response {:08x}", r.nt_status); if r.nt_status == SMB_NTSTATUS_SUCCESS { - match parse_smb_create_andx_response_record(&r.data[*andx_offset-SMB1_HEADER_SIZE..]) { + match parse_smb_create_andx_response_record( + &r.data[*andx_offset - SMB1_HEADER_SIZE..], + ) { Ok((_, cr)) => { SCLogDebug!("Create AndX {:?}", cr); let guid_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_FILENAME); match state.ssn2vec_map.remove(&guid_key) { Some(mut p) => { - p.retain(|&i|i != 0x00); + p.retain(|&i| i != 0x00); let mut fid = cr.fid.to_vec(); fid.extend_from_slice(&u32_as_bytes(r.ssn_id)); SCLogDebug!("SMB1_COMMAND_NT_CREATE_ANDX fid {:?}", fid); SCLogDebug!("fid {:?} name {:?}", fid, p); state.guid2name_map.insert(fid, p); - }, + } _ => { SCLogDebug!("SMBv1 response: GUID NOT FOUND"); - }, + } } let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX); if let Some(tx) = state.get_generic_tx(1, command as u16, &tx_hdr) { - SCLogDebug!("tx {} with {}/{} marked as done", - tx.id, command, &smb1_command_string(command)); + SCLogDebug!( + "tx {} with {}/{} marked as done", + tx.id, + command, + &smb1_command_string(command) + ); tx.set_status(r.nt_status, false); tx.response_done = true; - if let Some(SMBTransactionTypeData::CREATE(ref mut tdn)) = tx.type_data { + if let Some(SMBTransactionTypeData::CREATE(ref mut tdn)) = tx.type_data + { tdn.create_ts = cr.create_ts.as_unix(); tdn.last_access_ts = cr.last_access_ts.as_unix(); tdn.last_write_ts = cr.last_write_ts.as_unix(); @@ -757,39 +842,39 @@ fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, an } } true - }, + } _ => { events.push(SMBEvent::MalformedData); false - }, + } } } else { false } - }, + } SMB1_COMMAND_CLOSE => { - let fid = state.ssn2vec_map.remove(&SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID)); + let fid = state + .ssn2vec_map + .remove(&SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID)); if let Some(fid) = fid { SCLogDebug!("closing FID {:?}", fid); smb1_close_file(state, &fid, Direction::ToClient); } false - }, + } SMB1_COMMAND_TRANS => { smb1_trans_response_record(state, r); true - }, + } SMB1_COMMAND_SESSION_SETUP_ANDX => { smb1_session_setup_response(state, r, *andx_offset); true - }, + } SMB1_COMMAND_LOGOFF_ANDX => { tx_sync = true; false - }, - _ => { - false - }, + } + _ => false, }; if !have_tx && tx_sync { @@ -801,8 +886,12 @@ fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, an tx.set_events(events); } } else if !have_tx && smb1_check_tx(command) { - let tx_key = SMBCommonHdr::new(SMBHDR_TYPE_GENERICTX, - key_ssn_id as u64, key_tree_id as u32, key_multiplex_id as u64); + let tx_key = SMBCommonHdr::new( + SMBHDR_TYPE_GENERICTX, + key_ssn_id as u64, + key_tree_id as u32, + key_multiplex_id as u64, + ); let _have_tx2 = match state.get_generic_tx(1, command as u16, &tx_key) { Some(tx) => { tx.request_done = true; @@ -811,11 +900,11 @@ fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, an tx.set_status(r.nt_status, r.is_dos_error); tx.set_events(events); true - }, + } None => { SCLogDebug!("no TX found for key {:?}", tx_key); false - }, + } }; } else { SCLogDebug!("have tx for cmd {}", command); @@ -830,10 +919,13 @@ pub fn smb1_response_record(state: &mut SMBState, r: &SmbRecord) -> u32 { // continue for next andx command if any if smb1_command_is_andx(command) { - if let Ok((_, andx_hdr)) = smb1_parse_andx_header(&r.data[andx_offset-SMB1_HEADER_SIZE..]) { - if (andx_hdr.andx_offset as usize) > andx_offset && - andx_hdr.andx_command != SMB1_COMMAND_NONE && - (andx_hdr.andx_offset as usize) - SMB1_HEADER_SIZE < r.data.len() { + if let Ok((_, andx_hdr)) = + smb1_parse_andx_header(&r.data[andx_offset - SMB1_HEADER_SIZE..]) + { + if (andx_hdr.andx_offset as usize) > andx_offset + && andx_hdr.andx_command != SMB1_COMMAND_NONE + && (andx_hdr.andx_offset as usize) - SMB1_HEADER_SIZE < r.data.len() + { andx_offset = andx_hdr.andx_offset as usize; command = andx_hdr.andx_command; continue; @@ -846,9 +938,8 @@ pub fn smb1_response_record(state: &mut SMBState, r: &SmbRecord) -> u32 { 0 } -pub fn smb1_trans_request_record(state: &mut SMBState, r: &SmbRecord) -{ - let mut events : Vec = Vec::new(); +pub fn smb1_trans_request_record(state: &mut SMBState, r: &SmbRecord) { + let mut events: Vec = Vec::new(); match parse_smb_trans_request_record(r.data, r) { Ok((_, rd)) => { @@ -858,16 +949,20 @@ pub fn smb1_trans_request_record(state: &mut SMBState, r: &SmbRecord) let mut pipe_dcerpc = false; if rd.pipe.is_some() { let pipe = rd.pipe.unwrap(); - state.ssn2vec_map.insert(SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID), - pipe.fid.to_vec()); + state + .ssn2vec_map + .insert(SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID), pipe.fid.to_vec()); let mut frankenfid = pipe.fid.to_vec(); frankenfid.extend_from_slice(&u32_as_bytes(r.ssn_id)); let (_filename, is_dcerpc) = state.get_service_for_guid(&frankenfid); - SCLogDebug!("smb1_trans_request_record: name {} is_dcerpc {}", - _filename, is_dcerpc); + SCLogDebug!( + "smb1_trans_request_record: name {} is_dcerpc {}", + _filename, + is_dcerpc + ); pipe_dcerpc = is_dcerpc; } @@ -877,25 +972,26 @@ pub fn smb1_trans_request_record(state: &mut SMBState, r: &SmbRecord) let vercmd = SMBVerCmdStat::new1(r.command); smb_write_dcerpc_record(state, vercmd, hdr, rd.data.data); } - }, + } _ => { events.push(SMBEvent::MalformedData); - }, + } } smb1_request_record_generic(state, r, events); } -pub fn smb1_trans_response_record(state: &mut SMBState, r: &SmbRecord) -{ - let mut events : Vec = Vec::new(); +pub fn smb1_trans_response_record(state: &mut SMBState, r: &SmbRecord) { + let mut events: Vec = Vec::new(); match parse_smb_trans_response_record(r.data) { Ok((_, rd)) => { SCLogDebug!("TRANS response {:?}", rd); // see if we have a stored fid - let fid = match state.ssn2vec_map.remove( - &SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID)) { + let fid = match state + .ssn2vec_map + .remove(&SMBCommonHdr::from1(r, SMBHDR_TYPE_GUID)) + { Some(f) => f, None => Vec::new(), }; @@ -906,14 +1002,22 @@ pub fn smb1_trans_response_record(state: &mut SMBState, r: &SmbRecord) let (_filename, is_dcerpc) = state.get_service_for_guid(&frankenfid); - SCLogDebug!("smb1_trans_response_record: name {} is_dcerpc {}", - _filename, is_dcerpc); + SCLogDebug!( + "smb1_trans_response_record: name {} is_dcerpc {}", + _filename, + is_dcerpc + ); // if we get status 'BUFFER_OVERFLOW' this is only a part of // the data. Store it in the ssn/tree for later use. if r.nt_status == SMB_NTSTATUS_BUFFER_OVERFLOW { - let key = SMBHashKeyHdrGuid::new(SMBCommonHdr::from1(r, SMBHDR_TYPE_TRANS_FRAG), fid); - SCLogDebug!("SMBv1/TRANS: queueing data for len {} key {:?}", rd.data.len(), key); + let key = + SMBHashKeyHdrGuid::new(SMBCommonHdr::from1(r, SMBHDR_TYPE_TRANS_FRAG), fid); + SCLogDebug!( + "SMBv1/TRANS: queueing data for len {} key {:?}", + rd.data.len(), + key + ); state.ssnguid2vec_map.insert(key, rd.data.to_vec()); } else if is_dcerpc { SCLogDebug!("SMBv1 TRANS TO PIPE"); @@ -921,10 +1025,10 @@ pub fn smb1_trans_response_record(state: &mut SMBState, r: &SmbRecord) let vercmd = SMBVerCmdStat::new1_with_ntstatus(r.command, r.nt_status); smb_read_dcerpc_record(state, vercmd, hdr, &fid, rd.data); } - }, + } _ => { events.push(SMBEvent::MalformedData); - }, + } } // generic tx as well. Set events if needed. @@ -932,12 +1036,13 @@ pub fn smb1_trans_response_record(state: &mut SMBState, r: &SmbRecord) } /// Handle WRITE, WRITE_ANDX, WRITE_AND_CLOSE request records -pub fn smb1_write_request_record(state: &mut SMBState, r: &SmbRecord, andx_offset: usize, command: u8, nbss_remaining: u32) -{ - let mut events : Vec = Vec::new(); +pub fn smb1_write_request_record( + state: &mut SMBState, r: &SmbRecord, andx_offset: usize, command: u8, nbss_remaining: u32, +) { + let mut events: Vec = Vec::new(); let result = if command == SMB1_COMMAND_WRITE_ANDX { - parse_smb1_write_andx_request_record(&r.data[andx_offset-SMB1_HEADER_SIZE..], andx_offset) + parse_smb1_write_andx_request_record(&r.data[andx_offset - SMB1_HEADER_SIZE..], andx_offset) } else if command == SMB1_COMMAND_WRITE { parse_smb1_write_request_record(r.data) } else { @@ -955,30 +1060,36 @@ pub fn smb1_write_request_record(state: &mut SMBState, r: &SmbRecord, andx_offse } let mut file_fid = rd.fid.to_vec(); file_fid.extend_from_slice(&u32_as_bytes(r.ssn_id)); - SCLogDebug!("SMBv1 WRITE: FID {:?} offset {}", - file_fid, rd.offset); + SCLogDebug!("SMBv1 WRITE: FID {:?} offset {}", file_fid, rd.offset); let file_name = match state.guid2name_map.get(&file_fid) { Some(n) => n.to_vec(), None => b"".to_vec(), }; let mut set_event_fileoverlap = false; - let found = match state.get_file_tx_by_fuid_with_open_file(&file_fid, Direction::ToServer) { - Some(tx) => { - let file_id : u32 = tx.id as u32; - if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - if rd.offset < tdf.file_tracker.tracked { - set_event_fileoverlap = true; + let found = + match state.get_file_tx_by_fuid_with_open_file(&file_fid, Direction::ToServer) { + Some(tx) => { + let file_id: u32 = tx.id as u32; + if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { + if rd.offset < tdf.file_tracker.tracked { + set_event_fileoverlap = true; + } + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + rd.data, + rd.offset, + rd.len, + false, + &file_id, + ); + SCLogDebug!("FID {:?} found at tx {} => {:?}", file_fid, tx.id, tx); } - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, rd.data, rd.offset, - rd.len, false, &file_id); - SCLogDebug!("FID {:?} found at tx {} => {:?}", file_fid, tx.id, tx); + true } - true - }, - None => { false }, - }; + None => false, + }; if !found { let tree_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_SHARE); let (share_name, is_pipe) = match state.ssn2tree_map.get(&tree_key) { @@ -993,13 +1104,19 @@ pub fn smb1_write_request_record(state: &mut SMBState, r: &SmbRecord, andx_offse } else { let tx = state.new_file_tx(&file_fid, &file_name, Direction::ToServer); if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let file_id : u32 = tx.id as u32; + let file_id: u32 = tx.id as u32; if rd.offset < tdf.file_tracker.tracked { set_event_fileoverlap = true; } - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, rd.data, rd.offset, - rd.len, false, &file_id); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + rd.data, + rd.offset, + rd.len, + false, + &file_id, + ); tdf.share_name = share_name; SCLogDebug!("tdf {:?}", tdf); } @@ -1011,26 +1128,32 @@ pub fn smb1_write_request_record(state: &mut SMBState, r: &SmbRecord, andx_offse state.set_event(SMBEvent::FileOverlap); } - state.set_file_left(Direction::ToServer, rd.len, rd.data.len() as u32, file_fid.to_vec()); + state.set_file_left( + Direction::ToServer, + rd.len, + rd.data.len() as u32, + file_fid.to_vec(), + ); if command == SMB1_COMMAND_WRITE_AND_CLOSE { SCLogDebug!("closing FID {:?}", file_fid); smb1_close_file(state, &file_fid, Direction::ToServer); } - }, + } _ => { events.push(SMBEvent::MalformedData); - }, + } } smb1_request_record_generic(state, r, events); } -pub fn smb1_read_response_record(state: &mut SMBState, r: &SmbRecord, andx_offset: usize, nbss_remaining: u32) -{ - let mut events : Vec = Vec::new(); +pub fn smb1_read_response_record( + state: &mut SMBState, r: &SmbRecord, andx_offset: usize, nbss_remaining: u32, +) { + let mut events: Vec = Vec::new(); if r.nt_status == SMB_NTSTATUS_SUCCESS { - match parse_smb_read_andx_response_record(&r.data[andx_offset-SMB1_HEADER_SIZE..]) { + match parse_smb_read_andx_response_record(&r.data[andx_offset - SMB1_HEADER_SIZE..]) { Ok((_, rd)) => { SCLogDebug!("SMBv1: read response => {:?}", rd); if rd.len > nbss_remaining + rd.data.len() as u32 { @@ -1044,18 +1167,21 @@ pub fn smb1_read_response_record(state: &mut SMBState, r: &SmbRecord, andx_offse let (offset, file_fid) = match state.ssn2vecoffset_map.remove(&fid_key) { Some(o) => (o.offset, o.guid), None => { - SCLogDebug!("SMBv1 READ response: reply to unknown request: left {} {:?}", - rd.len - rd.data.len() as u32, rd); + SCLogDebug!( + "SMBv1 READ response: reply to unknown request: left {} {:?}", + rd.len - rd.data.len() as u32, + rd + ); state.set_skip(Direction::ToClient, nbss_remaining); return; - }, + } }; SCLogDebug!("SMBv1 READ: FID {:?} offset {}", file_fid, offset); let tree_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_SHARE); let (is_pipe, share_name) = match state.ssn2tree_map.get(&tree_key) { Some(n) => (n.is_pipe, n.name.to_vec()), - _ => { (false, Vec::new()) }, + _ => (false, Vec::new()), }; if !is_pipe { let file_name = match state.guid2name_map.get(&file_fid) { @@ -1063,33 +1189,47 @@ pub fn smb1_read_response_record(state: &mut SMBState, r: &SmbRecord, andx_offse None => Vec::new(), }; let mut set_event_fileoverlap = false; - let found = match state.get_file_tx_by_fuid_with_open_file(&file_fid, Direction::ToClient) { + let found = match state + .get_file_tx_by_fuid_with_open_file(&file_fid, Direction::ToClient) + { Some(tx) => { if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let file_id : u32 = tx.id as u32; + let file_id: u32 = tx.id as u32; SCLogDebug!("FID {:?} found at tx {}", file_fid, tx.id); if offset < tdf.file_tracker.tracked { set_event_fileoverlap = true; } - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, rd.data, offset, - rd.len, false, &file_id); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + rd.data, + offset, + rd.len, + false, + &file_id, + ); } true - }, - None => { false }, + } + None => false, }; if !found { let tx = state.new_file_tx(&file_fid, &file_name, Direction::ToClient); if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let file_id : u32 = tx.id as u32; + let file_id: u32 = tx.id as u32; SCLogDebug!("FID {:?} found at tx {}", file_fid, tx.id); if offset < tdf.file_tracker.tracked { set_event_fileoverlap = true; } - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, rd.data, offset, - rd.len, false, &file_id); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + rd.data, + offset, + rd.len, + false, + &file_id, + ); tdf.share_name = share_name; } tx.vercmd.set_smb1_cmd(SMB1_COMMAND_READ_ANDX); @@ -1104,15 +1244,24 @@ pub fn smb1_read_response_record(state: &mut SMBState, r: &SmbRecord, andx_offse // hack: we store fid with ssn id mixed in, but here we want the // real thing instead. - let pure_fid = if file_fid.len() > 2 { &file_fid[0..2] } else { &[] }; + let pure_fid = if file_fid.len() > 2 { + &file_fid[0..2] + } else { + &[] + }; smb_read_dcerpc_record(state, vercmd, hdr, pure_fid, rd.data); } - state.set_file_left(Direction::ToClient, rd.len, rd.data.len() as u32, file_fid.to_vec()); + state.set_file_left( + Direction::ToClient, + rd.len, + rd.data.len() as u32, + file_fid.to_vec(), + ); } _ => { events.push(SMBEvent::MalformedData); - }, + } } } diff --git a/rust/src/smb/smb1_records.rs b/rust/src/smb/smb1_records.rs index bf767da8b08b..7a36adde7ac0 100644 --- a/rust/src/smb/smb1_records.rs +++ b/rust/src/smb/smb1_records.rs @@ -22,9 +22,9 @@ use crate::smb::smb_records::*; use nom7::bytes::streaming::{tag, take}; use nom7::combinator::{complete, cond, peek, rest, verify}; use nom7::error::{make_error, ErrorKind}; -use nom7::Err; use nom7::multi::many1; -use nom7::number::streaming::{le_u8, le_u16, le_u32, le_u64}; +use nom7::number::streaming::{le_u16, le_u32, le_u64, le_u8}; +use nom7::Err; use nom7::IResult; pub const SMB1_HEADER_SIZE: usize = 32; @@ -32,14 +32,17 @@ pub const SMB1_HEADER_SIZE: usize = 32; // SMB_FLAGS_REPLY in Microsoft docs. const SMB1_FLAGS_RESPONSE: u8 = 0x80; -fn smb_get_unicode_string_with_offset(i: &[u8], offset: usize) -> IResult<&[u8], Vec, SmbError> -{ +fn smb_get_unicode_string_with_offset( + i: &[u8], offset: usize, +) -> IResult<&[u8], Vec, SmbError> { let (i, _) = cond(offset % 2 == 1, take(1_usize))(i)?; smb_get_unicode_string(i) } /// take a string, unicode or ascii based on record -pub fn smb1_get_string<'a>(i: &'a[u8], r: &SmbRecord, offset: usize) -> IResult<&'a[u8], Vec, SmbError> { +pub fn smb1_get_string<'a>( + i: &'a [u8], r: &SmbRecord, offset: usize, +) -> IResult<&'a [u8], Vec, SmbError> { if r.has_unicode_support() { smb_get_unicode_string_with_offset(i, offset) } else { @@ -47,8 +50,7 @@ pub fn smb1_get_string<'a>(i: &'a[u8], r: &SmbRecord, offset: usize) -> IResult< } } - -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbParamBlockAndXHeader { pub wct: u8, pub andx_command: u8, @@ -68,12 +70,12 @@ pub fn smb1_parse_andx_header(i: &[u8]) -> IResult<&[u8], SmbParamBlockAndXHeade Ok((i, hdr)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Smb1WriteRequestRecord<'a> { pub offset: u64, pub len: u32, - pub fid: &'a[u8], - pub data: &'a[u8], + pub fid: &'a [u8], + pub data: &'a [u8], } pub fn parse_smb1_write_request_record(i: &[u8]) -> IResult<&[u8], Smb1WriteRequestRecord> { @@ -90,12 +92,14 @@ pub fn parse_smb1_write_request_record(i: &[u8]) -> IResult<&[u8], Smb1WriteRequ offset: offset as u64, len: data_len as u32, fid, - data:file_data, + data: file_data, }; Ok((i, record)) } -pub fn parse_smb1_write_andx_request_record(i : &[u8], andx_offset: usize) -> IResult<&[u8], Smb1WriteRequestRecord> { +pub fn parse_smb1_write_andx_request_record( + i: &[u8], andx_offset: usize, +) -> IResult<&[u8], Smb1WriteRequestRecord> { let origin_i = i; let ax = andx_offset as u16; let (i, wct) = le_u8(i)?; @@ -109,14 +113,14 @@ pub fn parse_smb1_write_andx_request_record(i : &[u8], andx_offset: usize) -> IR let (i, _remaining) = le_u16(i)?; let (i, data_len_high) = le_u16(i)?; let (i, data_len_low) = le_u16(i)?; - let data_len = ((data_len_high as u32) << 16)|(data_len_low as u32); + let data_len = ((data_len_high as u32) << 16) | (data_len_low as u32); let (i, data_offset) = le_u16(i)?; - if data_offset < 0x3c || data_offset < ax{ + if data_offset < 0x3c || data_offset < ax { return Err(Err::Error(make_error(i, ErrorKind::LengthValue))); } let (i, high_offset) = cond(wct == 14, le_u32)(i)?; let (_i, _bcc) = le_u16(i)?; - let (i, _padding_data) = take(data_offset-ax)(origin_i)?; + let (i, _padding_data) = take(data_offset - ax)(origin_i)?; let (i, file_data) = take(std::cmp::min(data_len, i.len() as u32))(i)?; let record = Smb1WriteRequestRecord { @@ -128,7 +132,9 @@ pub fn parse_smb1_write_andx_request_record(i : &[u8], andx_offset: usize) -> IR Ok((i, record)) } -pub fn parse_smb1_write_and_close_request_record(i: &[u8]) -> IResult<&[u8], Smb1WriteRequestRecord> { +pub fn parse_smb1_write_and_close_request_record( + i: &[u8], +) -> IResult<&[u8], Smb1WriteRequestRecord> { let (i, _wct) = le_u8(i)?; let (i, fid) = take(2_usize)(i)?; let (i, count) = le_u16(i)?; @@ -146,25 +152,27 @@ pub fn parse_smb1_write_and_close_request_record(i: &[u8]) -> IResult<&[u8], Smb Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Smb1NegotiateProtocolResponseRecord<'a> { pub dialect_idx: u16, - pub server_guid: &'a[u8], + pub server_guid: &'a [u8], } -pub fn parse_smb1_negotiate_protocol_response_record_error(i: &[u8]) - -> IResult<&[u8], Smb1NegotiateProtocolResponseRecord> { - let (i, _wct) = le_u8(i)?; - let (i, _bcc) = le_u16(i)?; - let record = Smb1NegotiateProtocolResponseRecord { - dialect_idx: 0, - server_guid: &[], - }; - Ok((i, record)) +pub fn parse_smb1_negotiate_protocol_response_record_error( + i: &[u8], +) -> IResult<&[u8], Smb1NegotiateProtocolResponseRecord> { + let (i, _wct) = le_u8(i)?; + let (i, _bcc) = le_u16(i)?; + let record = Smb1NegotiateProtocolResponseRecord { + dialect_idx: 0, + server_guid: &[], + }; + Ok((i, record)) } -pub fn parse_smb1_negotiate_protocol_response_record_ok(i: &[u8]) - -> IResult<&[u8], Smb1NegotiateProtocolResponseRecord> { +pub fn parse_smb1_negotiate_protocol_response_record_ok( + i: &[u8], +) -> IResult<&[u8], Smb1NegotiateProtocolResponseRecord> { let (i, _wct) = le_u8(i)?; let (i, dialect_idx) = le_u16(i)?; let (i, _sec_mode) = le_u8(i)?; @@ -182,8 +190,9 @@ pub fn parse_smb1_negotiate_protocol_response_record_ok(i: &[u8]) Ok((i, record)) } -pub fn parse_smb1_negotiate_protocol_response_record(i: &[u8]) - -> IResult<&[u8], Smb1NegotiateProtocolResponseRecord> { +pub fn parse_smb1_negotiate_protocol_response_record( + i: &[u8], +) -> IResult<&[u8], Smb1NegotiateProtocolResponseRecord> { let (i, wct) = peek(le_u8)(i)?; match wct { 0 => parse_smb1_negotiate_protocol_response_record_error(i), @@ -191,13 +200,14 @@ pub fn parse_smb1_negotiate_protocol_response_record(i: &[u8]) } } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Smb1NegotiateProtocolRecord<'a> { pub dialects: Vec<&'a [u8]>, } -pub fn parse_smb1_negotiate_protocol_record(i: &[u8]) - -> IResult<&[u8], Smb1NegotiateProtocolRecord> { +pub fn parse_smb1_negotiate_protocol_record( + i: &[u8], +) -> IResult<&[u8], Smb1NegotiateProtocolRecord> { let (i, _wtc) = le_u8(i)?; let (i, _bcc) = le_u16(i)?; // dialects is a list of [1 byte buffer format][string][0 terminator] @@ -206,15 +216,15 @@ pub fn parse_smb1_negotiate_protocol_record(i: &[u8]) Ok((i, record)) } - -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Smb1ResponseRecordTreeConnectAndX<'a> { - pub service: &'a[u8], - pub nativefs: &'a[u8], + pub service: &'a [u8], + pub nativefs: &'a [u8], } -pub fn parse_smb_connect_tree_andx_response_record(i: &[u8]) - -> IResult<&[u8], Smb1ResponseRecordTreeConnectAndX> { +pub fn parse_smb_connect_tree_andx_response_record( + i: &[u8], +) -> IResult<&[u8], Smb1ResponseRecordTreeConnectAndX> { let (i, wct) = le_u8(i)?; let (i, _andx_command) = le_u8(i)?; let (i, _) = take(1_usize)(i)?; // reserved @@ -224,35 +234,30 @@ pub fn parse_smb_connect_tree_andx_response_record(i: &[u8]) let (i, _bcc) = le_u16(i)?; let (i, service) = take_until_and_consume(b"\x00")(i)?; let (i, nativefs) = take_until_and_consume(b"\x00")(i)?; - let record = Smb1ResponseRecordTreeConnectAndX { - service, - nativefs - }; + let record = Smb1ResponseRecordTreeConnectAndX { service, nativefs }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRecordTreeConnectAndX<'a> { pub path: Vec, - pub service: &'a[u8], + pub service: &'a [u8], } -pub fn parse_smb_connect_tree_andx_record<'a>(i: &'a[u8], r: &SmbRecord) - -> IResult<&'a[u8], SmbRecordTreeConnectAndX<'a>, SmbError> { - let (i, _skip1) = take(7_usize)(i)?; - let (i, pwlen) = le_u16(i)?; - let (i, _bcc) = le_u16(i)?; - let (i, _pw) = take(pwlen)(i)?; - let (i, path) = smb1_get_string(i, r, 11 + pwlen as usize)?; - let (i, service) = take_until_and_consume(b"\x00")(i)?; - let record = SmbRecordTreeConnectAndX { - path, - service - }; - Ok((i, record)) +pub fn parse_smb_connect_tree_andx_record<'a>( + i: &'a [u8], r: &SmbRecord, +) -> IResult<&'a [u8], SmbRecordTreeConnectAndX<'a>, SmbError> { + let (i, _skip1) = take(7_usize)(i)?; + let (i, pwlen) = le_u16(i)?; + let (i, _bcc) = le_u16(i)?; + let (i, _pw) = take(pwlen)(i)?; + let (i, path) = smb1_get_string(i, r, 11 + pwlen as usize)?; + let (i, service) = take_until_and_consume(b"\x00")(i)?; + let record = SmbRecordTreeConnectAndX { path, service }; + Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRecordTransRequest<'a> { pub params: SmbRecordTransRequestParams, pub pipe: Option>, @@ -260,26 +265,23 @@ pub struct SmbRecordTransRequest<'a> { pub data: SmbRecordTransRequestData<'a>, } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbPipeProtocolRecord<'a> { pub function: u16, - pub fid: &'a[u8], + pub fid: &'a [u8], } -pub fn parse_smb_trans_request_record_pipe(i: &[u8]) - -> IResult<&[u8], SmbPipeProtocolRecord, SmbError> { +pub fn parse_smb_trans_request_record_pipe( + i: &[u8], +) -> IResult<&[u8], SmbPipeProtocolRecord, SmbError> { let (i, fun) = le_u16(i)?; let (i, fid) = take(2_usize)(i)?; - let record = SmbPipeProtocolRecord { - function: fun, - fid - }; + let record = SmbPipeProtocolRecord { function: fun, fid }; Ok((i, record)) } - -#[derive(Debug,PartialEq, Eq)] -pub struct SmbRecordTransRequestParams<> { +#[derive(Debug, PartialEq, Eq)] +pub struct SmbRecordTransRequestParams { pub max_data_cnt: u16, param_cnt: u16, param_offset: u16, @@ -288,47 +290,49 @@ pub struct SmbRecordTransRequestParams<> { bcc: u16, } -pub fn parse_smb_trans_request_record_params(i: &[u8]) - -> IResult<&[u8], (SmbRecordTransRequestParams, Option), SmbError> -{ - let (i, wct) = le_u8(i)?; - let (i, _total_param_cnt) = le_u16(i)?; - let (i, _total_data_count) = le_u16(i)?; - let (i, _max_param_cnt) = le_u16(i)?; - let (i, max_data_cnt) = le_u16(i)?; - let (i, _max_setup_cnt) = le_u8(i)?; - let (i, _) = take(1_usize)(i)?; // reserved - let (i, _) = take(2_usize)(i)?; // flags - let (i, _timeout) = le_u32(i)?; - let (i, _) = take(2_usize)(i)?; // reserved - let (i, param_cnt) = le_u16(i)?; - let (i, param_offset) = le_u16(i)?; - let (i, data_cnt) = le_u16(i)?; - let (i, data_offset) = le_u16(i)?; - let (i, setup_cnt) = le_u8(i)?; - let (i, _) = take(1_usize)(i)?; // reserved - let (i, pipe) = cond(wct == 16 && setup_cnt == 2 && data_cnt > 0, parse_smb_trans_request_record_pipe)(i)?; - let (i, bcc) = le_u16(i)?; - let params = SmbRecordTransRequestParams { - max_data_cnt, - param_cnt, - param_offset, - data_cnt, - data_offset, - bcc - }; - Ok((i, (params, pipe))) +pub fn parse_smb_trans_request_record_params( + i: &[u8], +) -> IResult<&[u8], (SmbRecordTransRequestParams, Option), SmbError> { + let (i, wct) = le_u8(i)?; + let (i, _total_param_cnt) = le_u16(i)?; + let (i, _total_data_count) = le_u16(i)?; + let (i, _max_param_cnt) = le_u16(i)?; + let (i, max_data_cnt) = le_u16(i)?; + let (i, _max_setup_cnt) = le_u8(i)?; + let (i, _) = take(1_usize)(i)?; // reserved + let (i, _) = take(2_usize)(i)?; // flags + let (i, _timeout) = le_u32(i)?; + let (i, _) = take(2_usize)(i)?; // reserved + let (i, param_cnt) = le_u16(i)?; + let (i, param_offset) = le_u16(i)?; + let (i, data_cnt) = le_u16(i)?; + let (i, data_offset) = le_u16(i)?; + let (i, setup_cnt) = le_u8(i)?; + let (i, _) = take(1_usize)(i)?; // reserved + let (i, pipe) = cond( + wct == 16 && setup_cnt == 2 && data_cnt > 0, + parse_smb_trans_request_record_pipe, + )(i)?; + let (i, bcc) = le_u16(i)?; + let params = SmbRecordTransRequestParams { + max_data_cnt, + param_cnt, + param_offset, + data_cnt, + data_offset, + bcc, + }; + Ok((i, (params, pipe))) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRecordTransRequestData<'a> { - pub data: &'a[u8], + pub data: &'a [u8], } -pub fn parse_smb_trans_request_record_data(i: &[u8], - pad1: usize, param_cnt: u16, pad2: usize, data_len: u16) - -> IResult<&[u8], SmbRecordTransRequestData, SmbError> -{ +pub fn parse_smb_trans_request_record_data( + i: &[u8], pad1: usize, param_cnt: u16, pad2: usize, data_len: u16, +) -> IResult<&[u8], SmbRecordTransRequestData, SmbError> { let (i, _) = take(pad1)(i)?; let (i, _) = take(param_cnt)(i)?; let (i, _) = take(pad2)(i)?; @@ -337,9 +341,9 @@ pub fn parse_smb_trans_request_record_data(i: &[u8], Ok((i, req)) } -pub fn parse_smb_trans_request_record<'a>(i: &'a[u8], r: &SmbRecord) - -> IResult<&'a[u8], SmbRecordTransRequest<'a>, SmbError> -{ +pub fn parse_smb_trans_request_record<'a>( + i: &'a [u8], r: &SmbRecord, +) -> IResult<&'a [u8], SmbRecordTransRequest<'a>, SmbError> { let (rem, (params, pipe)) = parse_smb_trans_request_record_params(i)?; let mut offset = 32 + (i.len() - rem.len()); // init with SMB header SCLogDebug!("params {:?}: offset {}", params, offset); @@ -350,8 +354,7 @@ pub fn parse_smb_trans_request_record<'a>(i: &'a[u8], r: &SmbRecord) // spec says pad to 4 bytes, but traffic shows this doesn't // always happen. - let pad1 = if offset == params.param_offset as usize || - offset == params.data_offset as usize { + let pad1 = if offset == params.param_offset as usize || offset == params.data_offset as usize { 0 } else { offset % 4 @@ -370,68 +373,76 @@ pub fn parse_smb_trans_request_record<'a>(i: &'a[u8], r: &SmbRecord) }; SCLogDebug!("pad2 {}", pad2); - let d = match parse_smb_trans_request_record_data(rem2, - pad1, params.param_cnt, pad2, params.data_cnt) { + let d = match parse_smb_trans_request_record_data( + rem2, + pad1, + params.param_cnt, + pad2, + params.data_cnt, + ) { Ok((_, rd)) => rd, - Err(e) => { return Err(e); } + Err(e) => { + return Err(e); + } }; SCLogDebug!("d {:?}", d); d } else { - SmbRecordTransRequestData { data: &[], } // no data + SmbRecordTransRequestData { data: &[] } // no data }; let res = SmbRecordTransRequest { - params, pipe, txname: n, data: recdata, + params, + pipe, + txname: n, + data: recdata, }; Ok((rem, res)) } - -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRecordTransResponse<'a> { pub data_cnt: u16, pub bcc: u16, - pub data: &'a[u8], + pub data: &'a [u8], } pub fn parse_smb_trans_response_error_record(i: &[u8]) -> IResult<&[u8], SmbRecordTransResponse> { - let (i, _wct) = le_u8(i)?; - let (i, bcc) = le_u16(i)?; - let resp = SmbRecordTransResponse { - data_cnt: 0, - bcc, - data: &[], - }; - Ok((i, resp)) + let (i, _wct) = le_u8(i)?; + let (i, bcc) = le_u16(i)?; + let resp = SmbRecordTransResponse { + data_cnt: 0, + bcc, + data: &[], + }; + Ok((i, resp)) } pub fn parse_smb_trans_response_regular_record(i: &[u8]) -> IResult<&[u8], SmbRecordTransResponse> { - let (i, wct) = le_u8(i)?; - let (i, _total_param_cnt) = le_u16(i)?; - let (i, _total_data_count) = le_u16(i)?; - let (i, _) = take(2_usize)(i)?; // reserved - let (i, _param_cnt) = le_u16(i)?; - let (i, _param_offset) = le_u16(i)?; - let (i, _param_displacement) = le_u16(i)?; - let (i, data_cnt) = le_u16(i)?; - let (i, data_offset) = le_u16(i)?; - let (i, _data_displacement) = le_u16(i)?; - let (i, _setup_cnt) = le_u8(i)?; - let (i, _) = take(1_usize)(i)?; // reserved - let (i, bcc) = le_u16(i)?; - let (i, _) = take(1_usize)(i)?; // padding - let (i, _padding_evasion) = cond( - data_offset > 36+2*(wct as u16), - |b| take(data_offset - (36+2*(wct as u16)))(b) - )(i)?; - let (i, data) = take(data_cnt)(i)?; - let resp = SmbRecordTransResponse { - data_cnt, - bcc, - data - }; - Ok((i, resp)) + let (i, wct) = le_u8(i)?; + let (i, _total_param_cnt) = le_u16(i)?; + let (i, _total_data_count) = le_u16(i)?; + let (i, _) = take(2_usize)(i)?; // reserved + let (i, _param_cnt) = le_u16(i)?; + let (i, _param_offset) = le_u16(i)?; + let (i, _param_displacement) = le_u16(i)?; + let (i, data_cnt) = le_u16(i)?; + let (i, data_offset) = le_u16(i)?; + let (i, _data_displacement) = le_u16(i)?; + let (i, _setup_cnt) = le_u8(i)?; + let (i, _) = take(1_usize)(i)?; // reserved + let (i, bcc) = le_u16(i)?; + let (i, _) = take(1_usize)(i)?; // padding + let (i, _padding_evasion) = cond(data_offset > 36 + 2 * (wct as u16), |b| { + take(data_offset - (36 + 2 * (wct as u16)))(b) + })(i)?; + let (i, data) = take(data_cnt)(i)?; + let resp = SmbRecordTransResponse { + data_cnt, + bcc, + data, + }; + Ok((i, resp)) } pub fn parse_smb_trans_response_record(i: &[u8]) -> IResult<&[u8], SmbRecordTransResponse> { @@ -442,9 +453,9 @@ pub fn parse_smb_trans_response_record(i: &[u8]) -> IResult<&[u8], SmbRecordTran } } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRecordSetupAndX<'a> { - pub sec_blob: &'a[u8], + pub sec_blob: &'a [u8], } pub fn parse_smb_setup_andx_record(i: &[u8]) -> IResult<&[u8], SmbRecordSetupAndX> { @@ -457,39 +468,37 @@ pub fn parse_smb_setup_andx_record(i: &[u8]) -> IResult<&[u8], SmbRecordSetupAnd Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbResponseRecordSetupAndX<'a> { - pub sec_blob: &'a[u8], + pub sec_blob: &'a [u8], } fn response_setup_andx_record(i: &[u8]) -> IResult<&[u8], SmbResponseRecordSetupAndX> { - let (i, _skip1) = take(7_usize)(i)?; - let (i, sec_blob_len) = le_u16(i)?; - let (i, _bcc) = le_u16(i)?; - let (i, sec_blob) = take(sec_blob_len)(i)?; - let record = SmbResponseRecordSetupAndX { sec_blob }; - Ok((i, record)) + let (i, _skip1) = take(7_usize)(i)?; + let (i, sec_blob_len) = le_u16(i)?; + let (i, _bcc) = le_u16(i)?; + let (i, sec_blob) = take(sec_blob_len)(i)?; + let record = SmbResponseRecordSetupAndX { sec_blob }; + Ok((i, record)) } fn response_setup_andx_wct3_record(i: &[u8]) -> IResult<&[u8], SmbResponseRecordSetupAndX> { - let (i, _skip1) = take(7_usize)(i)?; - let (i, _bcc) = le_u16(i)?; - let record = SmbResponseRecordSetupAndX { - sec_blob: &[], - }; - Ok((i, record)) + let (i, _skip1) = take(7_usize)(i)?; + let (i, _bcc) = le_u16(i)?; + let record = SmbResponseRecordSetupAndX { sec_blob: &[] }; + Ok((i, record)) } fn response_setup_andx_error_record(i: &[u8]) -> IResult<&[u8], SmbResponseRecordSetupAndX> { - let (i, _wct) = le_u8(i)?; - let (i, _bcc) = le_u16(i)?; - let record = SmbResponseRecordSetupAndX { - sec_blob: &[], - }; - Ok((i, record)) + let (i, _wct) = le_u8(i)?; + let (i, _bcc) = le_u16(i)?; + let record = SmbResponseRecordSetupAndX { sec_blob: &[] }; + Ok((i, record)) } -pub fn parse_smb_response_setup_andx_record(i: &[u8]) -> IResult<&[u8], SmbResponseRecordSetupAndX> { +pub fn parse_smb_response_setup_andx_record( + i: &[u8], +) -> IResult<&[u8], SmbResponseRecordSetupAndX> { let (i, wct) = peek(le_u8)(i)?; match wct { 0 => response_setup_andx_error_record(i), @@ -498,9 +507,9 @@ pub fn parse_smb_response_setup_andx_record(i: &[u8]) -> IResult<&[u8], SmbRespo } } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRequestReadAndXRecord<'a> { - pub fid: &'a[u8], + pub fid: &'a [u8], pub size: u64, pub offset: u64, } @@ -516,19 +525,21 @@ pub fn parse_smb_read_andx_request_record(i: &[u8]) -> IResult<&[u8], SmbRequest let (i, _) = take(2_usize)(i)?; let (i, max_count_high) = le_u32(i)?; let (i, _) = take(2_usize)(i)?; - let (i, high_offset) = cond(wct == 12,le_u32)(i)?; // only from wct ==12? + let (i, high_offset) = cond(wct == 12, le_u32)(i)?; // only from wct ==12? let record = SmbRequestReadAndXRecord { fid, - size: (((max_count_high as u64) << 16)|max_count_low as u64), - offset: high_offset.map(|ho| (ho as u64) << 32 | offset as u64).unwrap_or(0), + size: (((max_count_high as u64) << 16) | max_count_low as u64), + offset: high_offset + .map(|ho| (ho as u64) << 32 | offset as u64) + .unwrap_or(0), }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbResponseReadAndXRecord<'a> { pub len: u32, - pub data: &'a[u8], + pub data: &'a [u8], } pub fn parse_smb_read_andx_response_record(i: &[u8]) -> IResult<&[u8], SmbResponseReadAndXRecord> { @@ -542,30 +553,28 @@ pub fn parse_smb_read_andx_response_record(i: &[u8]) -> IResult<&[u8], SmbRespon let (i, data_len_high) = le_u32(i)?; let (i, _) = take(6_usize)(i)?; // reserved let (i, bcc) = le_u16(i)?; - let (i, _padding) = cond( - bcc > data_len_low, - |b| take(bcc - data_len_low)(b) - )(i)?; // TODO figure out how this works with data_len_high - let (i, _padding_evasion) = cond( - data_offset > 36+2*(wct as u16), - |b| take(data_offset - (36+2*(wct as u16)))(b) - )(i)?; + let (i, _padding) = cond(bcc > data_len_low, |b| take(bcc - data_len_low)(b))(i)?; // TODO figure out how this works with data_len_high + let (i, _padding_evasion) = cond(data_offset > 36 + 2 * (wct as u16), |b| { + take(data_offset - (36 + 2 * (wct as u16)))(b) + })(i)?; let (i, file_data) = rest(i)?; let record = SmbResponseReadAndXRecord { - len: ((data_len_high << 16)|data_len_low as u32), + len: ((data_len_high << 16) | data_len_low as u32), data: file_data, - }; + }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRequestRenameRecord { pub oldname: Vec, pub newname: Vec, } -pub fn parse_smb_rename_request_record(i: &[u8]) -> IResult<&[u8], SmbRequestRenameRecord, SmbError> { +pub fn parse_smb_rename_request_record( + i: &[u8], +) -> IResult<&[u8], SmbRequestRenameRecord, SmbError> { let (i, _wct) = le_u8(i)?; let (i, _search_attr) = le_u16(i)?; let (i, _bcc) = le_u16(i)?; @@ -573,23 +582,20 @@ pub fn parse_smb_rename_request_record(i: &[u8]) -> IResult<&[u8], SmbRequestRen let (i, oldname) = smb_get_unicode_string(i)?; let (i, _newtype) = le_u8(i)?; let (i, newname) = smb_get_unicode_string_with_offset(i, 1)?; // HACK if we assume oldname is a series of utf16 chars offset would be 1 - let record = SmbRequestRenameRecord { - oldname, - newname - }; + let record = SmbRequestRenameRecord { oldname, newname }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] -pub struct SmbRequestCreateAndXRecord<> { +#[derive(Debug, PartialEq, Eq)] +pub struct SmbRequestCreateAndXRecord { pub disposition: u32, pub create_options: u32, pub file_name: Vec, } -pub fn parse_smb_create_andx_request_record<'a>(i: &'a[u8], r: &SmbRecord) - -> IResult<&'a[u8], SmbRequestCreateAndXRecord<>, SmbError> -{ +pub fn parse_smb_create_andx_request_record<'a>( + i: &'a [u8], r: &SmbRecord, +) -> IResult<&'a [u8], SmbRequestCreateAndXRecord, SmbError> { let (i, _skip1) = take(6_usize)(i)?; let (i, file_name_len) = le_u16(i)?; let (i, _skip3) = take(28_usize)(i)?; @@ -597,10 +603,9 @@ pub fn parse_smb_create_andx_request_record<'a>(i: &'a[u8], r: &SmbRecord) let (i, create_options) = le_u32(i)?; let (i, _skip2) = take(5_usize)(i)?; let (i, bcc) = le_u16(i)?; - let (i, file_name) = cond( - bcc >= file_name_len, - |b| smb1_get_string(b, r, (bcc - file_name_len) as usize) - )(i)?; + let (i, file_name) = cond(bcc >= file_name_len, |b| { + smb1_get_string(b, r, (bcc - file_name_len) as usize) + })(i)?; let (i, _skip3) = rest(i)?; let record = SmbRequestCreateAndXRecord { disposition, @@ -610,13 +615,14 @@ pub fn parse_smb_create_andx_request_record<'a>(i: &'a[u8], r: &SmbRecord) Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] -pub struct Trans2RecordParamSetFileInfoDisposition<> { +#[derive(Debug, PartialEq, Eq)] +pub struct Trans2RecordParamSetFileInfoDisposition { pub delete: bool, } -pub fn parse_trans2_request_data_set_file_info_disposition(i: &[u8]) - -> IResult<&[u8], Trans2RecordParamSetFileInfoDisposition> { +pub fn parse_trans2_request_data_set_file_info_disposition( + i: &[u8], +) -> IResult<&[u8], Trans2RecordParamSetFileInfoDisposition> { let (i, delete) = le_u8(i)?; let record = Trans2RecordParamSetFileInfoDisposition { delete: delete & 1 == 1, @@ -624,45 +630,51 @@ pub fn parse_trans2_request_data_set_file_info_disposition(i: &[u8]) Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Trans2RecordParamSetFileInfo<'a> { - pub fid: &'a[u8], + pub fid: &'a [u8], pub loi: u16, } -pub fn parse_trans2_request_params_set_file_info(i: &[u8]) -> IResult<&[u8], Trans2RecordParamSetFileInfo> { +pub fn parse_trans2_request_params_set_file_info( + i: &[u8], +) -> IResult<&[u8], Trans2RecordParamSetFileInfo> { let (i, fid) = take(2_usize)(i)?; let (i, loi) = le_u16(i)?; let record = Trans2RecordParamSetFileInfo { fid, loi }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Trans2RecordParamSetFileInfoRename<'a> { pub replace: bool, - pub newname: &'a[u8], + pub newname: &'a [u8], } -pub fn parse_trans2_request_data_set_file_info_rename(i: &[u8]) -> IResult<&[u8], Trans2RecordParamSetFileInfoRename> { +pub fn parse_trans2_request_data_set_file_info_rename( + i: &[u8], +) -> IResult<&[u8], Trans2RecordParamSetFileInfoRename> { let (i, replace) = le_u8(i)?; let (i, _reserved) = take(3_usize)(i)?; let (i, _root_dir) = take(4_usize)(i)?; let (i, newname_len) = le_u32(i)?; let (i, newname) = take(newname_len)(i)?; let record = Trans2RecordParamSetFileInfoRename { - replace: replace==1, + replace: replace == 1, newname, }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] -pub struct Trans2RecordParamSetPathInfo<> { +#[derive(Debug, PartialEq, Eq)] +pub struct Trans2RecordParamSetPathInfo { pub loi: u16, pub oldname: Vec, } -pub fn parse_trans2_request_params_set_path_info(i: &[u8]) -> IResult<&[u8], Trans2RecordParamSetPathInfo, SmbError> { +pub fn parse_trans2_request_params_set_path_info( + i: &[u8], +) -> IResult<&[u8], Trans2RecordParamSetPathInfo, SmbError> { let (i, loi) = le_u16(i)?; let (i, _reserved) = take(4_usize)(i)?; let (i, oldname) = smb_get_unicode_string(i)?; @@ -670,30 +682,32 @@ pub fn parse_trans2_request_params_set_path_info(i: &[u8]) -> IResult<&[u8], Tra Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Trans2RecordParamSetPathInfoRename<'a> { pub replace: bool, - pub newname: &'a[u8], + pub newname: &'a [u8], } -pub fn parse_trans2_request_data_set_path_info_rename(i: &[u8]) -> IResult<&[u8], Trans2RecordParamSetPathInfoRename> { +pub fn parse_trans2_request_data_set_path_info_rename( + i: &[u8], +) -> IResult<&[u8], Trans2RecordParamSetPathInfoRename> { let (i, replace) = le_u8(i)?; let (i, _reserved) = take(3_usize)(i)?; let (i, _root_dir) = take(4_usize)(i)?; let (i, newname_len) = le_u32(i)?; let (i, newname) = take(newname_len)(i)?; let record = Trans2RecordParamSetPathInfoRename { - replace: replace==1, - newname + replace: replace == 1, + newname, }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRequestTrans2Record<'a> { pub subcmd: u16, - pub setup_blob: &'a[u8], - pub data_blob: &'a[u8], + pub setup_blob: &'a [u8], + pub data_blob: &'a [u8], } pub fn parse_smb_trans2_request_record(i: &[u8]) -> IResult<&[u8], SmbRequestTrans2Record> { @@ -718,23 +732,22 @@ pub fn parse_smb_trans2_request_record(i: &[u8]) -> IResult<&[u8], SmbRequestTra //TODO test and use param_offset let (i, _padding) = take(3_usize)(i)?; let (i, setup_blob) = take(param_cnt)(i)?; - let (i, _padding2) = cond( - data_offset > param_offset + param_cnt, - |b| take(data_offset - param_offset - param_cnt)(b) - )(i)?; + let (i, _padding2) = cond(data_offset > param_offset + param_cnt, |b| { + take(data_offset - param_offset - param_cnt)(b) + })(i)?; let (i, data_blob) = take(data_cnt)(i)?; let record = SmbRequestTrans2Record { subcmd, setup_blob, - data_blob + data_blob, }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbResponseCreateAndXRecord<'a> { - pub fid: &'a[u8], + pub fid: &'a [u8], pub create_ts: SMBFiletime, pub last_access_ts: SMBFiletime, pub last_write_ts: SMBFiletime, @@ -742,7 +755,9 @@ pub struct SmbResponseCreateAndXRecord<'a> { pub file_size: u64, } -pub fn parse_smb_create_andx_response_record(i: &[u8]) -> IResult<&[u8], SmbResponseCreateAndXRecord> { +pub fn parse_smb_create_andx_response_record( + i: &[u8], +) -> IResult<&[u8], SmbResponseCreateAndXRecord> { let (i, wct) = le_u8(i)?; let (i, _andx_command) = le_u8(i)?; let (i, _) = take(1_usize)(i)?; // reserved @@ -773,22 +788,20 @@ pub fn parse_smb_create_andx_response_record(i: &[u8]) -> IResult<&[u8], SmbResp Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRequestCloseRecord<'a> { - pub fid: &'a[u8], + pub fid: &'a [u8], } pub fn parse_smb1_close_request_record(i: &[u8]) -> IResult<&[u8], SmbRequestCloseRecord> { let (i, _) = take(1_usize)(i)?; let (i, fid) = take(2_usize)(i)?; - let record = SmbRequestCloseRecord { - fid, - }; + let record = SmbRequestCloseRecord { fid }; Ok((i, record)) } -#[derive(Debug,PartialEq, Eq)] -pub struct SmbVersion<> { +#[derive(Debug, PartialEq, Eq)] +pub struct SmbVersion { pub version: u8, } @@ -799,7 +812,7 @@ pub fn parse_smb_version(i: &[u8]) -> IResult<&[u8], SmbVersion> { Ok((i, version)) } -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct SmbRecord<'a> { pub command: u8, pub is_dos_error: bool, @@ -814,7 +827,7 @@ pub struct SmbRecord<'a> { pub process_id: u32, pub ssn_id: u32, - pub data: &'a[u8], + pub data: &'a [u8], } impl<'a> SmbRecord<'a> { @@ -853,7 +866,7 @@ pub fn parse_smb_record(i: &[u8]) -> IResult<&[u8], SmbRecord> { nt_status, flags, flags2, - is_dos_error: (flags2 & 0x4000_u16 == 0),// && nt_status != 0), + is_dos_error: (flags2 & 0x4000_u16 == 0), // && nt_status != 0), tree_id, user_id, multiplex_id, @@ -870,7 +883,7 @@ pub fn parse_smb_record(i: &[u8]) -> IResult<&[u8], SmbRecord> { fn test_parse_smb1_write_andx_request_record_origin() { let data = hex::decode("0eff000000014000000000ff00000008001400000014003f000000000014004142434445464748494a4b4c4d4e4f5051520a0a").unwrap(); let result = parse_smb1_write_andx_request_record(&data, SMB1_HEADER_SIZE); - assert!(result.is_ok()); + assert!(result.is_ok()); let record = result.unwrap().1; assert_eq!(record.offset, 0); assert_eq!(record.len, 20); diff --git a/rust/src/smb/smb1_session.rs b/rust/src/smb/smb1_session.rs index c39c7ce98fc9..644b2ad09473 100644 --- a/rust/src/smb/smb1_session.rs +++ b/rust/src/smb/smb1_session.rs @@ -15,11 +15,11 @@ * 02110-1301, USA. */ -use crate::smb::smb_records::*; -use crate::smb::smb1_records::*; -use crate::smb::smb::*; -use crate::smb::events::*; use crate::smb::auth::*; +use crate::smb::events::*; +use crate::smb::smb::*; +use crate::smb::smb1_records::*; +use crate::smb::smb_records::*; #[derive(Debug)] pub struct SessionSetupRequest { @@ -34,27 +34,27 @@ pub struct SessionSetupResponse { pub native_lm: Vec, } -pub fn smb1_session_setup_request_host_info(r: &SmbRecord, blob: &[u8]) -> SessionSetupRequest -{ +pub fn smb1_session_setup_request_host_info(r: &SmbRecord, blob: &[u8]) -> SessionSetupRequest { if blob.len() > 1 && r.has_unicode_support() { let offset = r.data.len() - blob.len(); let blob = if offset % 2 == 1 { &blob[1..] } else { blob }; let (native_os, native_lm, primary_domain) = match smb_get_unicode_string(blob) { - Ok((rem, n1)) => { - match smb_get_unicode_string(rem) { - Ok((rem, n2)) => { - match smb_get_unicode_string(rem) { - Ok((_, n3)) => { (n1, n2, n3) }, - _ => { (n1, n2, Vec::new()) }, - } - }, - _ => { (n1, Vec::new(), Vec::new()) }, - } + Ok((rem, n1)) => match smb_get_unicode_string(rem) { + Ok((rem, n2)) => match smb_get_unicode_string(rem) { + Ok((_, n3)) => (n1, n2, n3), + _ => (n1, n2, Vec::new()), + }, + _ => (n1, Vec::new(), Vec::new()), }, - _ => { (Vec::new(), Vec::new(), Vec::new()) }, + _ => (Vec::new(), Vec::new(), Vec::new()), }; - SCLogDebug!("name1 {:?} name2 {:?} name3 {:?}", native_os,native_lm,primary_domain); + SCLogDebug!( + "name1 {:?} name2 {:?} name3 {:?}", + native_os, + native_lm, + primary_domain + ); SessionSetupRequest { native_os, native_lm, @@ -62,18 +62,14 @@ pub fn smb1_session_setup_request_host_info(r: &SmbRecord, blob: &[u8]) -> Sessi } } else { let (native_os, native_lm, primary_domain) = match smb_get_ascii_string(blob) { - Ok((rem, n1)) => { - match smb_get_ascii_string(rem) { - Ok((rem, n2)) => { - match smb_get_ascii_string(rem) { - Ok((_, n3)) => { (n1, n2, n3) }, - _ => { (n1, n2, Vec::new()) }, - } - }, - _ => { (n1, Vec::new(), Vec::new()) }, - } + Ok((rem, n1)) => match smb_get_ascii_string(rem) { + Ok((rem, n2)) => match smb_get_ascii_string(rem) { + Ok((_, n3)) => (n1, n2, n3), + _ => (n1, n2, Vec::new()), + }, + _ => (n1, Vec::new(), Vec::new()), }, - _ => { (Vec::new(), Vec::new(), Vec::new()) }, + _ => (Vec::new(), Vec::new(), Vec::new()), }; SCLogDebug!("session_setup_request_host_info: not unicode"); @@ -85,22 +81,19 @@ pub fn smb1_session_setup_request_host_info(r: &SmbRecord, blob: &[u8]) -> Sessi } } -pub fn smb1_session_setup_response_host_info(r: &SmbRecord, blob: &[u8]) -> SessionSetupResponse -{ +pub fn smb1_session_setup_response_host_info(r: &SmbRecord, blob: &[u8]) -> SessionSetupResponse { if blob.len() > 1 && r.has_unicode_support() { let offset = r.data.len() - blob.len(); let blob = if offset % 2 == 1 { &blob[1..] } else { blob }; let (native_os, native_lm) = match smb_get_unicode_string(blob) { - Ok((rem, n1)) => { - match smb_get_unicode_string(rem) { - Ok((_, n2)) => (n1, n2), - _ => { (n1, Vec::new()) }, - } + Ok((rem, n1)) => match smb_get_unicode_string(rem) { + Ok((_, n2)) => (n1, n2), + _ => (n1, Vec::new()), }, - _ => { (Vec::new(), Vec::new()) }, + _ => (Vec::new(), Vec::new()), }; - SCLogDebug!("name1 {:?} name2 {:?}", native_os,native_lm); + SCLogDebug!("name1 {:?} name2 {:?}", native_os, native_lm); SessionSetupResponse { native_os, native_lm, @@ -108,13 +101,11 @@ pub fn smb1_session_setup_response_host_info(r: &SmbRecord, blob: &[u8]) -> Sess } else { SCLogDebug!("session_setup_response_host_info: not unicode"); let (native_os, native_lm) = match smb_get_ascii_string(blob) { - Ok((rem, n1)) => { - match smb_get_ascii_string(rem) { - Ok((_, n2)) => (n1, n2), - _ => { (n1, Vec::new()) }, - } + Ok((rem, n1)) => match smb_get_ascii_string(rem) { + Ok((_, n2)) => (n1, n2), + _ => (n1, Vec::new()), }, - _ => { (Vec::new(), Vec::new()) }, + _ => (Vec::new(), Vec::new()), }; SessionSetupResponse { native_os, @@ -123,14 +114,17 @@ pub fn smb1_session_setup_response_host_info(r: &SmbRecord, blob: &[u8]) -> Sess } } -pub fn smb1_session_setup_request(state: &mut SMBState, r: &SmbRecord, andx_offset: usize) -{ +pub fn smb1_session_setup_request(state: &mut SMBState, r: &SmbRecord, andx_offset: usize) { SCLogDebug!("SMB1_COMMAND_SESSION_SETUP_ANDX user_id {}", r.user_id); #[allow(clippy::single_match)] - match parse_smb_setup_andx_record(&r.data[andx_offset-SMB1_HEADER_SIZE..]) { + match parse_smb_setup_andx_record(&r.data[andx_offset - SMB1_HEADER_SIZE..]) { Ok((rem, setup)) => { - let hdr = SMBCommonHdr::new(SMBHDR_TYPE_HEADER, - r.ssn_id as u64, 0, r.multiplex_id as u64); + let hdr = SMBCommonHdr::new( + SMBHDR_TYPE_HEADER, + r.ssn_id as u64, + 0, + r.multiplex_id as u64, + ); let tx = state.new_sessionsetup_tx(hdr); tx.vercmd.set_smb1_cmd(r.command); @@ -146,24 +140,23 @@ pub fn smb1_session_setup_request(state: &mut SMBState, r: &SmbRecord, andx_offs } } } - }, + } _ => { // events.push(SMBEvent::MalformedData); - }, + } } } -fn smb1_session_setup_update_tx(tx: &mut SMBTransaction, r: &SmbRecord, andx_offset: usize) -{ - match parse_smb_response_setup_andx_record(&r.data[andx_offset-SMB1_HEADER_SIZE..]) { +fn smb1_session_setup_update_tx(tx: &mut SMBTransaction, r: &SmbRecord, andx_offset: usize) { + match parse_smb_response_setup_andx_record(&r.data[andx_offset - SMB1_HEADER_SIZE..]) { Ok((rem, _setup)) => { if let Some(SMBTransactionTypeData::SESSIONSETUP(ref mut td)) = tx.type_data { td.response_host = Some(smb1_session_setup_response_host_info(r, rem)); } - }, + } _ => { tx.set_event(SMBEvent::MalformedData); - }, + } } // update tx even if we can't parse the response tx.hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_HEADER); // to overwrite ssn_id 0 @@ -171,32 +164,37 @@ fn smb1_session_setup_update_tx(tx: &mut SMBTransaction, r: &SmbRecord, andx_off tx.response_done = true; } -pub fn smb1_session_setup_response(state: &mut SMBState, r: &SmbRecord, andx_offset: usize) -{ +pub fn smb1_session_setup_response(state: &mut SMBState, r: &SmbRecord, andx_offset: usize) { // try exact match with session id already set (e.g. NTLMSSP AUTH phase) - let found = r.ssn_id != 0 && match state.get_sessionsetup_tx( - SMBCommonHdr::new(SMBHDR_TYPE_HEADER, - r.ssn_id as u64, 0, r.multiplex_id as u64)) - { - Some(tx) => { - smb1_session_setup_update_tx(tx, r, andx_offset); - SCLogDebug!("smb1_session_setup_response: tx {:?}", tx); - true - }, - None => { false }, - }; + let found = r.ssn_id != 0 + && match state.get_sessionsetup_tx(SMBCommonHdr::new( + SMBHDR_TYPE_HEADER, + r.ssn_id as u64, + 0, + r.multiplex_id as u64, + )) { + Some(tx) => { + smb1_session_setup_update_tx(tx, r, andx_offset); + SCLogDebug!("smb1_session_setup_response: tx {:?}", tx); + true + } + None => false, + }; // otherwise try match with ssn id 0 (e.g. NTLMSSP_NEGOTIATE) if !found { - match state.get_sessionsetup_tx( - SMBCommonHdr::new(SMBHDR_TYPE_HEADER, 0, 0, r.multiplex_id as u64)) - { + match state.get_sessionsetup_tx(SMBCommonHdr::new( + SMBHDR_TYPE_HEADER, + 0, + 0, + r.multiplex_id as u64, + )) { Some(tx) => { smb1_session_setup_update_tx(tx, r, andx_offset); SCLogDebug!("smb1_session_setup_response: tx {:?}", tx); - }, + } None => { SCLogDebug!("smb1_session_setup_response: tx not found for {:?}", r); - }, + } } } } diff --git a/rust/src/smb/smb2.rs b/rust/src/smb/smb2.rs index a2fe021b0276..c88c4feaea3b 100644 --- a/rust/src/smb/smb2.rs +++ b/rust/src/smb/smb2.rs @@ -19,59 +19,61 @@ use nom7::Err; use crate::core::*; -use crate::smb::smb::*; -use crate::smb::smb2_records::*; -use crate::smb::smb2_session::*; -use crate::smb::smb2_ioctl::*; use crate::smb::dcerpc::*; use crate::smb::events::*; use crate::smb::files::*; +use crate::smb::smb::*; +use crate::smb::smb2_ioctl::*; +use crate::smb::smb2_records::*; +use crate::smb::smb2_session::*; use crate::smb::smb_status::*; -pub const SMB2_COMMAND_NEGOTIATE_PROTOCOL: u16 = 0; -pub const SMB2_COMMAND_SESSION_SETUP: u16 = 1; -pub const SMB2_COMMAND_SESSION_LOGOFF: u16 = 2; -pub const SMB2_COMMAND_TREE_CONNECT: u16 = 3; -pub const SMB2_COMMAND_TREE_DISCONNECT: u16 = 4; -pub const SMB2_COMMAND_CREATE: u16 = 5; -pub const SMB2_COMMAND_CLOSE: u16 = 6; -pub const SMB2_COMMAND_FLUSH: u16 = 7; -pub const SMB2_COMMAND_READ: u16 = 8; -pub const SMB2_COMMAND_WRITE: u16 = 9; -pub const SMB2_COMMAND_LOCK: u16 = 10; -pub const SMB2_COMMAND_IOCTL: u16 = 11; -pub const SMB2_COMMAND_CANCEL: u16 = 12; -pub const SMB2_COMMAND_KEEPALIVE: u16 = 13; -pub const SMB2_COMMAND_FIND: u16 = 14; -pub const SMB2_COMMAND_CHANGE_NOTIFY: u16 = 15; -pub const SMB2_COMMAND_GET_INFO: u16 = 16; -pub const SMB2_COMMAND_SET_INFO: u16 = 17; -pub const SMB2_COMMAND_OPLOCK_BREAK: u16 = 18; +pub const SMB2_COMMAND_NEGOTIATE_PROTOCOL: u16 = 0; +pub const SMB2_COMMAND_SESSION_SETUP: u16 = 1; +pub const SMB2_COMMAND_SESSION_LOGOFF: u16 = 2; +pub const SMB2_COMMAND_TREE_CONNECT: u16 = 3; +pub const SMB2_COMMAND_TREE_DISCONNECT: u16 = 4; +pub const SMB2_COMMAND_CREATE: u16 = 5; +pub const SMB2_COMMAND_CLOSE: u16 = 6; +pub const SMB2_COMMAND_FLUSH: u16 = 7; +pub const SMB2_COMMAND_READ: u16 = 8; +pub const SMB2_COMMAND_WRITE: u16 = 9; +pub const SMB2_COMMAND_LOCK: u16 = 10; +pub const SMB2_COMMAND_IOCTL: u16 = 11; +pub const SMB2_COMMAND_CANCEL: u16 = 12; +pub const SMB2_COMMAND_KEEPALIVE: u16 = 13; +pub const SMB2_COMMAND_FIND: u16 = 14; +pub const SMB2_COMMAND_CHANGE_NOTIFY: u16 = 15; +pub const SMB2_COMMAND_GET_INFO: u16 = 16; +pub const SMB2_COMMAND_SET_INFO: u16 = 17; +pub const SMB2_COMMAND_OPLOCK_BREAK: u16 = 18; pub fn smb2_command_string(c: u16) -> String { match c { - SMB2_COMMAND_NEGOTIATE_PROTOCOL => "SMB2_COMMAND_NEGOTIATE_PROTOCOL", - SMB2_COMMAND_SESSION_SETUP => "SMB2_COMMAND_SESSION_SETUP", - SMB2_COMMAND_SESSION_LOGOFF => "SMB2_COMMAND_SESSION_LOGOFF", - SMB2_COMMAND_TREE_CONNECT => "SMB2_COMMAND_TREE_CONNECT", - SMB2_COMMAND_TREE_DISCONNECT => "SMB2_COMMAND_TREE_DISCONNECT", - SMB2_COMMAND_CREATE => "SMB2_COMMAND_CREATE", - SMB2_COMMAND_CLOSE => "SMB2_COMMAND_CLOSE", - SMB2_COMMAND_READ => "SMB2_COMMAND_READ", - SMB2_COMMAND_FLUSH => "SMB2_COMMAND_FLUSH", - SMB2_COMMAND_WRITE => "SMB2_COMMAND_WRITE", - SMB2_COMMAND_LOCK => "SMB2_COMMAND_LOCK", - SMB2_COMMAND_IOCTL => "SMB2_COMMAND_IOCTL", - SMB2_COMMAND_CANCEL => "SMB2_COMMAND_CANCEL", - SMB2_COMMAND_KEEPALIVE => "SMB2_COMMAND_KEEPALIVE", - SMB2_COMMAND_FIND => "SMB2_COMMAND_FIND", - SMB2_COMMAND_CHANGE_NOTIFY => "SMB2_COMMAND_CHANGE_NOTIFY", - SMB2_COMMAND_GET_INFO => "SMB2_COMMAND_GET_INFO", - SMB2_COMMAND_SET_INFO => "SMB2_COMMAND_SET_INFO", - SMB2_COMMAND_OPLOCK_BREAK => "SMB2_COMMAND_OPLOCK_BREAK", - _ => { return (c).to_string(); }, - }.to_string() - + SMB2_COMMAND_NEGOTIATE_PROTOCOL => "SMB2_COMMAND_NEGOTIATE_PROTOCOL", + SMB2_COMMAND_SESSION_SETUP => "SMB2_COMMAND_SESSION_SETUP", + SMB2_COMMAND_SESSION_LOGOFF => "SMB2_COMMAND_SESSION_LOGOFF", + SMB2_COMMAND_TREE_CONNECT => "SMB2_COMMAND_TREE_CONNECT", + SMB2_COMMAND_TREE_DISCONNECT => "SMB2_COMMAND_TREE_DISCONNECT", + SMB2_COMMAND_CREATE => "SMB2_COMMAND_CREATE", + SMB2_COMMAND_CLOSE => "SMB2_COMMAND_CLOSE", + SMB2_COMMAND_READ => "SMB2_COMMAND_READ", + SMB2_COMMAND_FLUSH => "SMB2_COMMAND_FLUSH", + SMB2_COMMAND_WRITE => "SMB2_COMMAND_WRITE", + SMB2_COMMAND_LOCK => "SMB2_COMMAND_LOCK", + SMB2_COMMAND_IOCTL => "SMB2_COMMAND_IOCTL", + SMB2_COMMAND_CANCEL => "SMB2_COMMAND_CANCEL", + SMB2_COMMAND_KEEPALIVE => "SMB2_COMMAND_KEEPALIVE", + SMB2_COMMAND_FIND => "SMB2_COMMAND_FIND", + SMB2_COMMAND_CHANGE_NOTIFY => "SMB2_COMMAND_CHANGE_NOTIFY", + SMB2_COMMAND_GET_INFO => "SMB2_COMMAND_GET_INFO", + SMB2_COMMAND_SET_INFO => "SMB2_COMMAND_SET_INFO", + SMB2_COMMAND_OPLOCK_BREAK => "SMB2_COMMAND_OPLOCK_BREAK", + _ => { + return (c).to_string(); + } + } + .to_string() } pub fn smb2_dialect_string(d: u16) -> String { @@ -85,24 +87,25 @@ pub fn smb2_dialect_string(d: u16) -> String { 0x0302 => "3.02", 0x0310 => "3.10", 0x0311 => "3.11", - _ => { return (d).to_string(); }, - }.to_string() + _ => { + return (d).to_string(); + } + } + .to_string() } // later we'll use this to determine if we need to // track a ssn per type fn smb2_create_new_tx(cmd: u16) -> bool { match cmd { - SMB2_COMMAND_READ | - SMB2_COMMAND_WRITE | - SMB2_COMMAND_GET_INFO | - SMB2_COMMAND_SET_INFO => { false }, - _ => { true }, + SMB2_COMMAND_READ | SMB2_COMMAND_WRITE | SMB2_COMMAND_GET_INFO | SMB2_COMMAND_SET_INFO => { + false + } + _ => true, } } -fn smb2_read_response_record_generic(state: &mut SMBState, r: &Smb2Record) -{ +fn smb2_read_response_record_generic(state: &mut SMBState, r: &Smb2Record) { if smb2_create_new_tx(r.command) { let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); let tx = state.get_generic_tx(2, r.command, &tx_hdr); @@ -113,8 +116,7 @@ fn smb2_read_response_record_generic(state: &mut SMBState, r: &Smb2Record) } } -pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_remaining: u32) -{ +pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_remaining: u32) { let max_queue_size = unsafe { SMB_CFG_MAX_READ_QUEUE_SIZE }; let max_queue_cnt = unsafe { SMB_CFG_MAX_READ_QUEUE_CNT }; @@ -132,15 +134,14 @@ pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_rema if r.nt_status == SMB_NTSTATUS_BUFFER_OVERFLOW { SCLogDebug!("SMBv2/READ: incomplete record, expecting a follow up"); // fall through - } else if r.nt_status != SMB_NTSTATUS_SUCCESS { SCLogDebug!("SMBv2: read response error code received: skip record"); state.set_skip(Direction::ToClient, nbss_remaining); return; } - if (state.max_read_size != 0 && rd.len > state.max_read_size) || - (unsafe { SMB_CFG_MAX_READ_SIZE != 0 && SMB_CFG_MAX_READ_SIZE < rd.len }) + if (state.max_read_size != 0 && rd.len > state.max_read_size) + || (unsafe { SMB_CFG_MAX_READ_SIZE != 0 && SMB_CFG_MAX_READ_SIZE < rd.len }) { state.set_event(SMBEvent::ReadResponseTooLarge); state.set_skip(Direction::ToClient, nbss_remaining); @@ -155,52 +156,68 @@ pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_rema let (offset, file_guid) = match state.ssn2vecoffset_map.remove(&guid_key) { Some(o) => (o.offset, o.guid), None => { - SCLogDebug!("SMBv2 READ response: reply to unknown request {:?}",rd); + SCLogDebug!("SMBv2 READ response: reply to unknown request {:?}", rd); state.set_skip(Direction::ToClient, nbss_remaining); return; - }, + } }; SCLogDebug!("SMBv2 READ: GUID {:?} offset {}", file_guid, offset); let mut set_event_fileoverlap = false; // look up existing tracker and if we have it update it - let found = match state.get_file_tx_by_fuid_with_open_file(&file_guid, Direction::ToClient) { - Some(tx) => { - if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let file_id : u32 = tx.id as u32; - if offset < tdf.file_tracker.tracked { - set_event_fileoverlap = true; - } - if max_queue_size != 0 && tdf.file_tracker.get_inflight_size() + rd.len as u64 > max_queue_size.into() { - state.set_event(SMBEvent::ReadQueueSizeExceeded); - state.set_skip(Direction::ToClient, nbss_remaining); - } else if max_queue_cnt != 0 && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize { - state.set_event(SMBEvent::ReadQueueCntExceeded); - state.set_skip(Direction::ToClient, nbss_remaining); - } else { - filetracker_newchunk(&mut tdf.file_tracker, - &tdf.file_name, rd.data, offset, - rd.len, false, &file_id); + let found = + match state.get_file_tx_by_fuid_with_open_file(&file_guid, Direction::ToClient) { + Some(tx) => { + if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { + let file_id: u32 = tx.id as u32; + if offset < tdf.file_tracker.tracked { + set_event_fileoverlap = true; + } + if max_queue_size != 0 + && tdf.file_tracker.get_inflight_size() + rd.len as u64 + > max_queue_size.into() + { + state.set_event(SMBEvent::ReadQueueSizeExceeded); + state.set_skip(Direction::ToClient, nbss_remaining); + } else if max_queue_cnt != 0 + && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize + { + state.set_event(SMBEvent::ReadQueueCntExceeded); + state.set_skip(Direction::ToClient, nbss_remaining); + } else { + filetracker_newchunk( + &mut tdf.file_tracker, + &tdf.file_name, + rd.data, + offset, + rd.len, + false, + &file_id, + ); + } } + true } - true - }, - None => { false }, - }; + None => false, + }; SCLogDebug!("existing file tx? {}", found); if !found { let tree_key = SMBCommonHdr::from2(r, SMBHDR_TYPE_SHARE); let (share_name, mut is_pipe) = match state.ssn2tree_map.get(&tree_key) { Some(n) => (n.name.to_vec(), n.is_pipe), - _ => { (Vec::new(), false) }, + _ => (Vec::new(), false), }; let mut is_dcerpc = if is_pipe || share_name.is_empty() { state.get_service_for_guid(&file_guid).1 } else { false }; - SCLogDebug!("SMBv2/READ: share_name {:?} is_pipe {} is_dcerpc {}", - share_name, is_pipe, is_dcerpc); + SCLogDebug!( + "SMBv2/READ: share_name {:?} is_pipe {} is_dcerpc {}", + share_name, + is_pipe, + is_dcerpc + ); if share_name.is_empty() && !is_pipe { SCLogDebug!("SMBv2/READ: no tree connect seen, we don't know if we are a pipe"); @@ -211,7 +228,9 @@ pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_rema let tree = SMBTree::new(b"suricata::dcerpc".to_vec(), true); state.ssn2tree_map.insert(tree_key, tree); if !is_dcerpc { - state.guid2name_map.insert(file_guid.to_vec(), b"suricata::dcerpc".to_vec()); + state + .guid2name_map + .insert(file_guid.to_vec(), b"suricata::dcerpc".to_vec()); } is_pipe = true; is_dcerpc = true; @@ -230,30 +249,40 @@ pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_rema state.set_skip(Direction::ToClient, nbss_remaining); } else { let file_name = match state.guid2name_map.get(&file_guid) { - Some(n) => { n.to_vec() } - None => { b"".to_vec() } + Some(n) => n.to_vec(), + None => b"".to_vec(), }; let tx = state.new_file_tx(&file_guid, &file_name, Direction::ToClient); tx.vercmd.set_smb2_cmd(SMB2_COMMAND_READ); - tx.hdr = SMBCommonHdr::new(SMBHDR_TYPE_HEADER, - r.session_id, r.tree_id, 0); // TODO move into new_file_tx + tx.hdr = SMBCommonHdr::new(SMBHDR_TYPE_HEADER, r.session_id, r.tree_id, 0); // TODO move into new_file_tx if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { tdf.share_name = share_name; - let file_id : u32 = tx.id as u32; + let file_id: u32 = tx.id as u32; if offset < tdf.file_tracker.tracked { set_event_fileoverlap = true; } - if max_queue_size != 0 && tdf.file_tracker.get_inflight_size() + rd.len as u64 > max_queue_size.into() { + if max_queue_size != 0 + && tdf.file_tracker.get_inflight_size() + rd.len as u64 + > max_queue_size.into() + { state.set_event(SMBEvent::ReadQueueSizeExceeded); state.set_skip(Direction::ToClient, nbss_remaining); - } else if max_queue_cnt != 0 && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize { + } else if max_queue_cnt != 0 + && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize + { state.set_event(SMBEvent::ReadQueueCntExceeded); state.set_skip(Direction::ToClient, nbss_remaining); } else { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, rd.data, offset, - rd.len, false, &file_id); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + rd.data, + offset, + rd.len, + false, + &file_id, + ); } } } @@ -262,7 +291,12 @@ pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_rema if set_event_fileoverlap { state.set_event(SMBEvent::FileOverlap); } - state.set_file_left(Direction::ToClient, rd.len, rd.data.len() as u32, file_guid.to_vec()); + state.set_file_left( + Direction::ToClient, + rd.len, + rd.data.len() as u32, + file_guid.to_vec(), + ); } _ => { SCLogDebug!("SMBv2: failed to parse read response"); @@ -271,8 +305,7 @@ pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record, nbss_rema } } -pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record, nbss_remaining: u32) -{ +pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record, nbss_remaining: u32) { let max_queue_size = unsafe { SMB_CFG_MAX_WRITE_QUEUE_SIZE }; let max_queue_cnt = unsafe { SMB_CFG_MAX_WRITE_QUEUE_CNT }; @@ -291,8 +324,9 @@ pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record, nbss_rema state.set_skip(Direction::ToServer, nbss_remaining); return; } - if (state.max_write_size != 0 && wr.wr_len > state.max_write_size) || - (unsafe { SMB_CFG_MAX_WRITE_SIZE != 0 && SMB_CFG_MAX_WRITE_SIZE < wr.wr_len }) { + if (state.max_write_size != 0 && wr.wr_len > state.max_write_size) + || (unsafe { SMB_CFG_MAX_WRITE_SIZE != 0 && SMB_CFG_MAX_WRITE_SIZE < wr.wr_len }) + { state.set_event(SMBEvent::WriteRequestTooLarge); state.set_skip(Direction::ToServer, nbss_remaining); return; @@ -309,46 +343,64 @@ pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record, nbss_rema }; let mut set_event_fileoverlap = false; - let found = match state.get_file_tx_by_fuid_with_open_file(&file_guid, Direction::ToServer) { - Some(tx) => { - if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let file_id : u32 = tx.id as u32; - if wr.wr_offset < tdf.file_tracker.tracked { - set_event_fileoverlap = true; - } - if max_queue_size != 0 && tdf.file_tracker.get_inflight_size() + wr.wr_len as u64 > max_queue_size.into() { - state.set_event(SMBEvent::WriteQueueSizeExceeded); - state.set_skip(Direction::ToServer, nbss_remaining); - } else if max_queue_cnt != 0 && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize { - state.set_event(SMBEvent::WriteQueueCntExceeded); - state.set_skip(Direction::ToServer, nbss_remaining); - } else { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, wr.data, wr.wr_offset, - wr.wr_len, false, &file_id); + let found = + match state.get_file_tx_by_fuid_with_open_file(&file_guid, Direction::ToServer) { + Some(tx) => { + if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { + let file_id: u32 = tx.id as u32; + if wr.wr_offset < tdf.file_tracker.tracked { + set_event_fileoverlap = true; + } + if max_queue_size != 0 + && tdf.file_tracker.get_inflight_size() + wr.wr_len as u64 + > max_queue_size.into() + { + state.set_event(SMBEvent::WriteQueueSizeExceeded); + state.set_skip(Direction::ToServer, nbss_remaining); + } else if max_queue_cnt != 0 + && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize + { + state.set_event(SMBEvent::WriteQueueCntExceeded); + state.set_skip(Direction::ToServer, nbss_remaining); + } else { + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + wr.data, + wr.wr_offset, + wr.wr_len, + false, + &file_id, + ); + } } + true } - true - }, - None => { false }, - }; + None => false, + }; if !found { let tree_key = SMBCommonHdr::from2(r, SMBHDR_TYPE_SHARE); let (share_name, mut is_pipe) = match state.ssn2tree_map.get(&tree_key) { - Some(n) => { (n.name.to_vec(), n.is_pipe) }, - _ => { (Vec::new(), false) }, + Some(n) => (n.name.to_vec(), n.is_pipe), + _ => (Vec::new(), false), }; let mut is_dcerpc = if is_pipe || share_name.is_empty() { state.get_service_for_guid(wr.guid).1 } else { false }; - SCLogDebug!("SMBv2/WRITE: share_name {:?} is_pipe {} is_dcerpc {}", - share_name, is_pipe, is_dcerpc); + SCLogDebug!( + "SMBv2/WRITE: share_name {:?} is_pipe {} is_dcerpc {}", + share_name, + is_pipe, + is_dcerpc + ); // if we missed the TREE connect we can't be sure if 'is_dcerpc' is correct if share_name.is_empty() && !is_pipe { - SCLogDebug!("SMBv2/WRITE: no tree connect seen, we don't know if we are a pipe"); + SCLogDebug!( + "SMBv2/WRITE: no tree connect seen, we don't know if we are a pipe" + ); if smb_dcerpc_probe(wr.data) { SCLogDebug!("SMBv2/WRITE: looks like we have dcerpc"); @@ -356,8 +408,9 @@ pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record, nbss_rema let tree = SMBTree::new(b"suricata::dcerpc".to_vec(), true); state.ssn2tree_map.insert(tree_key, tree); if !is_dcerpc { - state.guid2name_map.insert(file_guid.to_vec(), - b"suricata::dcerpc".to_vec()); + state + .guid2name_map + .insert(file_guid.to_vec(), b"suricata::dcerpc".to_vec()); } is_pipe = true; is_dcerpc = true; @@ -376,24 +429,34 @@ pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record, nbss_rema } else { let tx = state.new_file_tx(&file_guid, &file_name, Direction::ToServer); tx.vercmd.set_smb2_cmd(SMB2_COMMAND_WRITE); - tx.hdr = SMBCommonHdr::new(SMBHDR_TYPE_HEADER, - r.session_id, r.tree_id, 0); // TODO move into new_file_tx + tx.hdr = SMBCommonHdr::new(SMBHDR_TYPE_HEADER, r.session_id, r.tree_id, 0); // TODO move into new_file_tx if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { - let file_id : u32 = tx.id as u32; + let file_id: u32 = tx.id as u32; if wr.wr_offset < tdf.file_tracker.tracked { set_event_fileoverlap = true; } - if max_queue_size != 0 && tdf.file_tracker.get_inflight_size() + wr.wr_len as u64 > max_queue_size.into() { + if max_queue_size != 0 + && tdf.file_tracker.get_inflight_size() + wr.wr_len as u64 + > max_queue_size.into() + { state.set_event(SMBEvent::WriteQueueSizeExceeded); state.set_skip(Direction::ToServer, nbss_remaining); - } else if max_queue_cnt != 0 && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize { + } else if max_queue_cnt != 0 + && tdf.file_tracker.get_inflight_cnt() >= max_queue_cnt as usize + { state.set_event(SMBEvent::WriteQueueCntExceeded); state.set_skip(Direction::ToServer, nbss_remaining); } else { - filetracker_newchunk(&mut tdf.file_tracker, - &file_name, wr.data, wr.wr_offset, - wr.wr_len, false, &file_id); + filetracker_newchunk( + &mut tdf.file_tracker, + &file_name, + wr.data, + wr.wr_offset, + wr.wr_len, + false, + &file_id, + ); } } } @@ -402,20 +465,28 @@ pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record, nbss_rema if set_event_fileoverlap { state.set_event(SMBEvent::FileOverlap); } - state.set_file_left(Direction::ToServer, wr.wr_len, wr.data.len() as u32, file_guid.to_vec()); - }, + state.set_file_left( + Direction::ToServer, + wr.wr_len, + wr.data.len() as u32, + file_guid.to_vec(), + ); + } _ => { state.set_event(SMBEvent::MalformedData); - }, + } } } -pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record) -{ - SCLogDebug!("SMBv2 request record, command {} tree {} session {}", - &smb2_command_string(r.command), r.tree_id, r.session_id); +pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record) { + SCLogDebug!( + "SMBv2 request record, command {} tree {} session {}", + &smb2_command_string(r.command), + r.tree_id, + r.session_id + ); - let mut events : Vec = Vec::new(); + let mut events: Vec = Vec::new(); let have_tx = match r.command { SMB2_COMMAND_SET_INFO => { @@ -428,10 +499,10 @@ pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record) Smb2SetInfoRequestData::RENAME(ref ren) => { let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); let mut newname = ren.name.to_vec(); - newname.retain(|&i|i != 0x00); + newname.retain(|&i| i != 0x00); let oldname = match state.guid2name_map.get(rd.guid) { - Some(n) => { n.to_vec() }, - None => { b"".to_vec() }, + Some(n) => n.to_vec(), + None => b"".to_vec(), }; let tx = state.new_rename_tx(rd.guid.to_vec(), oldname, newname); tx.hdr = tx_hdr; @@ -442,22 +513,29 @@ pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record) Smb2SetInfoRequestData::DISPOSITION(ref dis) => { let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); let fname = match state.guid2name_map.get(rd.guid) { - Some(n) => { n.to_vec() }, + Some(n) => n.to_vec(), None => { // try to find latest created file in case of chained commands - let mut guid_key = SMBCommonHdr::from2_notree(r, SMBHDR_TYPE_FILENAME); + let mut guid_key = + SMBCommonHdr::from2_notree(r, SMBHDR_TYPE_FILENAME); if guid_key.msg_id == 0 { b"".to_vec() } else { guid_key.msg_id -= 1; match state.ssn2vec_map.get(&guid_key) { - Some(n) => { n.to_vec() }, - None => { b"".to_vec()}, + Some(n) => n.to_vec(), + None => b"".to_vec(), } } - }, + } }; - let tx = state.new_setfileinfo_tx(fname, rd.guid.to_vec(), rd.class as u16, rd.infolvl as u16, dis.delete); + let tx = state.new_setfileinfo_tx( + fname, + rd.guid.to_vec(), + rd.class as u16, + rd.infolvl as u16, + dis.delete, + ); tx.hdr = tx_hdr; tx.request_done = true; tx.vercmd.set_smb2_cmd(SMB2_COMMAND_SET_INFO); @@ -465,145 +543,146 @@ pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record) } _ => false, } - }, + } Err(Err::Incomplete(_n)) => { SCLogDebug!("SMB2_COMMAND_SET_INFO: {:?}", _n); events.push(SMBEvent::MalformedData); false - }, - Err(Err::Error(_e)) | - Err(Err::Failure(_e)) => { + } + Err(Err::Error(_e)) | Err(Err::Failure(_e)) => { SCLogDebug!("SMB2_COMMAND_SET_INFO: {:?}", _e); events.push(SMBEvent::MalformedData); false - }, + } }; have_si_tx - }, + } SMB2_COMMAND_IOCTL => { smb2_ioctl_request_record(state, r); true - }, + } SMB2_COMMAND_TREE_DISCONNECT => { let tree_key = SMBCommonHdr::from2(r, SMBHDR_TYPE_SHARE); state.ssn2tree_map.remove(&tree_key); false } - SMB2_COMMAND_NEGOTIATE_PROTOCOL => { - match parse_smb2_request_negotiate_protocol(r.data) { - Ok((_, rd)) => { - let mut dialects : Vec> = Vec::new(); - for d in rd.dialects_vec { - SCLogDebug!("dialect {:x} => {}", d, &smb2_dialect_string(d)); - let dvec = smb2_dialect_string(d).as_bytes().to_vec(); - dialects.push(dvec); - } + SMB2_COMMAND_NEGOTIATE_PROTOCOL => match parse_smb2_request_negotiate_protocol(r.data) { + Ok((_, rd)) => { + let mut dialects: Vec> = Vec::new(); + for d in rd.dialects_vec { + SCLogDebug!("dialect {:x} => {}", d, &smb2_dialect_string(d)); + let dvec = smb2_dialect_string(d).as_bytes().to_vec(); + dialects.push(dvec); + } - let found = match state.get_negotiate_tx(2) { - Some(_) => { - SCLogDebug!("WEIRD, should not have NEGOTIATE tx!"); - true - }, - None => { false }, - }; - if !found { - let tx = state.new_negotiate_tx(2); - if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = tx.type_data { - tdn.dialects2 = dialects; - tdn.client_guid = Some(rd.client_guid.to_vec()); - } - tx.request_done = true; + let found = match state.get_negotiate_tx(2) { + Some(_) => { + SCLogDebug!("WEIRD, should not have NEGOTIATE tx!"); + true } - true - }, - _ => { - events.push(SMBEvent::MalformedData); - false - }, + None => false, + }; + if !found { + let tx = state.new_negotiate_tx(2); + if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = tx.type_data { + tdn.dialects2 = dialects; + tdn.client_guid = Some(rd.client_guid.to_vec()); + } + tx.request_done = true; + } + true + } + _ => { + events.push(SMBEvent::MalformedData); + false } }, SMB2_COMMAND_SESSION_SETUP => { smb2_session_setup_request(state, r); true - }, - SMB2_COMMAND_TREE_CONNECT => { - match parse_smb2_request_tree_connect(r.data) { - Ok((_, tr)) => { - let name_key = SMBCommonHdr::from2(r, SMBHDR_TYPE_TREE); - let mut name_val = tr.share_name.to_vec(); - name_val.retain(|&i|i != 0x00); - if name_val.len() > 1 { - name_val = name_val[1..].to_vec(); - } - - let tx = state.new_treeconnect_tx(name_key, name_val); - tx.request_done = true; - tx.vercmd.set_smb2_cmd(SMB2_COMMAND_TREE_CONNECT); - true + } + SMB2_COMMAND_TREE_CONNECT => match parse_smb2_request_tree_connect(r.data) { + Ok((_, tr)) => { + let name_key = SMBCommonHdr::from2(r, SMBHDR_TYPE_TREE); + let mut name_val = tr.share_name.to_vec(); + name_val.retain(|&i| i != 0x00); + if name_val.len() > 1 { + name_val = name_val[1..].to_vec(); } - _ => { - events.push(SMBEvent::MalformedData); - false - }, + + let tx = state.new_treeconnect_tx(name_key, name_val); + tx.request_done = true; + tx.vercmd.set_smb2_cmd(SMB2_COMMAND_TREE_CONNECT); + true + } + _ => { + events.push(SMBEvent::MalformedData); + false } }, SMB2_COMMAND_READ => { match parse_smb2_request_read(r.data) { Ok((_, rd)) => { - if (state.max_read_size != 0 && rd.rd_len > state.max_read_size) || - (unsafe { SMB_CFG_MAX_READ_SIZE != 0 && SMB_CFG_MAX_READ_SIZE < rd.rd_len }) { + if (state.max_read_size != 0 && rd.rd_len > state.max_read_size) + || (unsafe { + SMB_CFG_MAX_READ_SIZE != 0 && SMB_CFG_MAX_READ_SIZE < rd.rd_len + }) + { events.push(SMBEvent::ReadRequestTooLarge); } else { - SCLogDebug!("SMBv2 READ: GUID {:?} requesting {} bytes at offset {}", - rd.guid, rd.rd_len, rd.rd_offset); + SCLogDebug!( + "SMBv2 READ: GUID {:?} requesting {} bytes at offset {}", + rd.guid, + rd.rd_len, + rd.rd_offset + ); // store read guid,offset in map let guid_key = SMBCommonHdr::from2_notree(r, SMBHDR_TYPE_OFFSET); let guidoff = SMBFileGUIDOffset::new(rd.guid.to_vec(), rd.rd_offset); state.ssn2vecoffset_map.insert(guid_key, guidoff); } - }, + } _ => { events.push(SMBEvent::MalformedData); - }, + } } false - }, - SMB2_COMMAND_CREATE => { - match parse_smb2_request_create(r.data) { - Ok((_, cr)) => { - let del = cr.create_options & 0x0000_1000 != 0; - let dir = cr.create_options & 0x0000_0001 != 0; - - SCLogDebug!("create_options {:08x}", cr.create_options); - - let name_key = SMBCommonHdr::from2_notree(r, SMBHDR_TYPE_FILENAME); - state.ssn2vec_map.insert(name_key, cr.data.to_vec()); - - let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); - let tx = state.new_create_tx(cr.data, - cr.disposition, del, dir, tx_hdr); - tx.vercmd.set_smb2_cmd(r.command); - SCLogDebug!("TS CREATE TX {} created", tx.id); - true - }, - _ => { - events.push(SMBEvent::MalformedData); - false - }, + } + SMB2_COMMAND_CREATE => match parse_smb2_request_create(r.data) { + Ok((_, cr)) => { + let del = cr.create_options & 0x0000_1000 != 0; + let dir = cr.create_options & 0x0000_0001 != 0; + + SCLogDebug!("create_options {:08x}", cr.create_options); + + let name_key = SMBCommonHdr::from2_notree(r, SMBHDR_TYPE_FILENAME); + state.ssn2vec_map.insert(name_key, cr.data.to_vec()); + + let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); + let tx = state.new_create_tx(cr.data, cr.disposition, del, dir, tx_hdr); + tx.vercmd.set_smb2_cmd(r.command); + SCLogDebug!("TS CREATE TX {} created", tx.id); + true + } + _ => { + events.push(SMBEvent::MalformedData); + false } }, SMB2_COMMAND_WRITE => { smb2_write_request_record(state, r, 0); true // write handling creates both file tx and generic tx - }, + } SMB2_COMMAND_CLOSE => { match parse_smb2_request_close(r.data) { Ok((_, cd)) => { let found_ts = match state.get_file_tx_by_fuid(cd.guid, Direction::ToServer) { Some(tx) => { if !tx.request_done { - if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { + if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = + tx.type_data + { filetracker_close(&mut tdf.file_tracker); } } @@ -611,13 +690,15 @@ pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record) tx.response_done = true; tx.set_status(SMB_NTSTATUS_SUCCESS, false); true - }, - None => { false }, + } + None => false, }; let found_tc = match state.get_file_tx_by_fuid(cd.guid, Direction::ToClient) { Some(tx) => { if !tx.request_done { - if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data { + if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = + tx.type_data + { filetracker_close(&mut tdf.file_tracker); } } @@ -625,82 +706,91 @@ pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record) tx.response_done = true; tx.set_status(SMB_NTSTATUS_SUCCESS, false); true - }, - None => { false }, + } + None => false, }; if !found_ts && !found_tc { SCLogDebug!("SMBv2: CLOSE(TS): no TX at GUID {:?}", cd.guid); } - }, + } _ => { events.push(SMBEvent::MalformedData); - }, + } } false - }, - _ => { - false - }, + } + _ => false, }; /* if we don't have a tx, create it here (maybe) */ if !have_tx && smb2_create_new_tx(r.command) { let tx_key = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); let tx = state.new_generic_tx(2, r.command, tx_key); - SCLogDebug!("TS TX {} command {} created with session_id {} tree_id {} message_id {}", - tx.id, r.command, r.session_id, r.tree_id, r.message_id); + SCLogDebug!( + "TS TX {} command {} created with session_id {} tree_id {} message_id {}", + tx.id, + r.command, + r.session_id, + r.tree_id, + r.message_id + ); tx.set_events(events); } } -pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) -{ - SCLogDebug!("SMBv2 response record, command {} status {} tree {} session {} message {}", - &smb2_command_string(r.command), r.nt_status, - r.tree_id, r.session_id, r.message_id); +pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) { + SCLogDebug!( + "SMBv2 response record, command {} status {} tree {} session {} message {}", + &smb2_command_string(r.command), + r.nt_status, + r.tree_id, + r.session_id, + r.message_id + ); - let mut events : Vec = Vec::new(); + let mut events: Vec = Vec::new(); let have_tx = match r.command { SMB2_COMMAND_IOCTL => { smb2_ioctl_response_record(state, r); true - }, + } SMB2_COMMAND_SESSION_SETUP => { smb2_session_setup_response(state, r); true - }, + } SMB2_COMMAND_WRITE => { if r.nt_status == SMB_NTSTATUS_SUCCESS { - match parse_smb2_response_write(r.data) - { + match parse_smb2_response_write(r.data) { Ok((_, _wr)) => { SCLogDebug!("SMBv2: Write response => {:?}", _wr); /* search key-guid map */ - let guid_key = SMBCommonHdr::new(SMBHDR_TYPE_GUID, - r.session_id, r.tree_id, r.message_id); + let guid_key = SMBCommonHdr::new( + SMBHDR_TYPE_GUID, + r.session_id, + r.tree_id, + r.message_id, + ); let _guid_vec = match state.ssn2vec_map.remove(&guid_key) { Some(p) => p, None => { SCLogDebug!("SMBv2 response: GUID NOT FOUND"); Vec::new() - }, + } }; SCLogDebug!("SMBv2 write response for GUID {:?}", _guid_vec); } _ => { events.push(SMBEvent::MalformedData); - }, + } } } false // the request may have created a generic tx, so handle that here - }, + } SMB2_COMMAND_READ => { - if r.nt_status == SMB_NTSTATUS_SUCCESS || - r.nt_status == SMB_NTSTATUS_BUFFER_OVERFLOW { + if r.nt_status == SMB_NTSTATUS_SUCCESS || r.nt_status == SMB_NTSTATUS_BUFFER_OVERFLOW { smb2_read_response_record(state, r, 0); false - } else if r.nt_status == SMB_NTSTATUS_END_OF_FILE { SCLogDebug!("SMBv2: read response => EOF"); @@ -710,7 +800,7 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) _ => { SCLogDebug!("SMBv2 READ response: reply to unknown request"); Vec::new() - }, + } }; let found = match state.get_file_tx_by_fuid(&file_guid, Direction::ToClient) { Some(tx) => { @@ -722,8 +812,8 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) tx.set_status(r.nt_status, false); tx.request_done = true; false - }, - None => { false }, + } + None => false, }; if !found { SCLogDebug!("SMBv2 READ: no TX at GUID {:?}", file_guid); @@ -733,7 +823,7 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) SCLogDebug!("SMBv2 READ: status {}", r.nt_status); false } - }, + } SMB2_COMMAND_CREATE => { if r.nt_status == SMB_NTSTATUS_SUCCESS { match parse_smb2_response_create(r.data) { @@ -742,7 +832,7 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) let guid_key = SMBCommonHdr::from2_notree(r, SMBHDR_TYPE_FILENAME); if let Some(mut p) = state.ssn2vec_map.remove(&guid_key) { - p.retain(|&i|i != 0x00); + p.retain(|&i| i != 0x00); state.guid2name_map.insert(cr.guid.to_vec(), p); } else { SCLogDebug!("SMBv2 response: GUID NOT FOUND"); @@ -750,12 +840,17 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); if let Some(tx) = state.get_generic_tx(2, r.command, &tx_hdr) { - SCLogDebug!("tx {} with {}/{} marked as done", - tx.id, r.command, &smb2_command_string(r.command)); + SCLogDebug!( + "tx {} with {}/{} marked as done", + tx.id, + r.command, + &smb2_command_string(r.command) + ); tx.set_status(r.nt_status, false); tx.response_done = true; - if let Some(SMBTransactionTypeData::CREATE(ref mut tdn)) = tx.type_data { + if let Some(SMBTransactionTypeData::CREATE(ref mut tdn)) = tx.type_data + { tdn.create_ts = cr.create_ts.as_unix(); tdn.last_access_ts = cr.last_access_ts.as_unix(); tdn.last_write_ts = cr.last_write_ts.as_unix(); @@ -767,13 +862,13 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) } _ => { events.push(SMBEvent::MalformedData); - }, + } } true } else { false } - }, + } SMB2_COMMAND_TREE_DISCONNECT => { // normally removed when processing request, // but in case we missed that try again here @@ -790,7 +885,9 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) let is_pipe = tr.share_type == 2; let found = match state.get_treeconnect_tx(name_key) { Some(tx) => { - if let Some(SMBTransactionTypeData::TREECONNECT(ref mut tdn)) = tx.type_data { + if let Some(SMBTransactionTypeData::TREECONNECT(ref mut tdn)) = + tx.type_data + { tdn.share_type = tr.share_type; tdn.is_pipe = is_pipe; tdn.tree_id = r.tree_id; @@ -801,8 +898,8 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) tx.response_done = true; tx.set_status(r.nt_status, false); true - }, - None => { false }, + } + None => false, }; if found { let tree = SMBTree::new(share_name.to_vec(), is_pipe); @@ -814,7 +911,7 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) _ => { events.push(SMBEvent::MalformedData); false - }, + } } } else { let name_key = SMBCommonHdr::from2(r, SMBHDR_TYPE_TREE); @@ -823,12 +920,12 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) tx.response_done = true; tx.set_status(r.nt_status, false); true - }, - None => { false }, + } + None => false, }; found } - }, + } SMB2_COMMAND_NEGOTIATE_PROTOCOL => { let res = if r.nt_status == SMB_NTSTATUS_SUCCESS { parse_smb2_response_negotiate_protocol(r.data) @@ -854,60 +951,73 @@ pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record) let found2 = match state.get_negotiate_tx(2) { Some(tx) => { - if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = tx.type_data { + if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = + tx.type_data + { tdn.server_guid = rd.server_guid.to_vec(); } tx.set_status(r.nt_status, false); tx.response_done = true; true - }, - None => { false }, + } + None => false, }; // SMB2 response to SMB1 request? - let found1 = !found2 && match state.get_negotiate_tx(1) { - Some(tx) => { - if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = tx.type_data { - tdn.server_guid = rd.server_guid.to_vec(); + let found1 = !found2 + && match state.get_negotiate_tx(1) { + Some(tx) => { + if let Some(SMBTransactionTypeData::NEGOTIATE(ref mut tdn)) = + tx.type_data + { + tdn.server_guid = rd.server_guid.to_vec(); + } + tx.set_status(r.nt_status, false); + tx.response_done = true; + true } - tx.set_status(r.nt_status, false); - tx.response_done = true; - true - }, - None => { false }, - }; + None => false, + }; found1 || found2 - }, + } _ => { events.push(SMBEvent::MalformedData); false } } - }, + } _ => { SCLogDebug!("default case: no TX"); false - }, + } }; if !have_tx { let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX); - SCLogDebug!("looking for TX {} with session_id {} tree_id {} message_id {}", - &smb2_command_string(r.command), - r.session_id, r.tree_id, r.message_id); + SCLogDebug!( + "looking for TX {} with session_id {} tree_id {} message_id {}", + &smb2_command_string(r.command), + r.session_id, + r.tree_id, + r.message_id + ); let _found = match state.get_generic_tx(2, r.command, &tx_hdr) { Some(tx) => { - SCLogDebug!("tx {} with {}/{} marked as done", - tx.id, r.command, &smb2_command_string(r.command)); + SCLogDebug!( + "tx {} with {}/{} marked as done", + tx.id, + r.command, + &smb2_command_string(r.command) + ); if r.nt_status != SMB_NTSTATUS_PENDING { tx.response_done = true; } tx.set_status(r.nt_status, false); tx.set_events(events); true - }, + } _ => { SCLogDebug!("no tx found for {:?}", r); false - }, + } }; } } diff --git a/rust/src/smb/smb2_ioctl.rs b/rust/src/smb/smb2_ioctl.rs index 73687aa5568f..4677f680ea9a 100644 --- a/rust/src/smb/smb2_ioctl.rs +++ b/rust/src/smb/smb2_ioctl.rs @@ -15,13 +15,13 @@ * 02110-1301, USA. */ -use crate::smb::smb::*; -use crate::smb::smb2::*; -use crate::smb::smb2_records::*; use crate::smb::dcerpc::*; use crate::smb::events::*; #[cfg(feature = "debug")] use crate::smb::funcs::*; +use crate::smb::smb::*; +use crate::smb::smb2::*; +use crate::smb::smb2_records::*; use crate::smb::smb_status::*; #[derive(Debug)] @@ -31,25 +31,26 @@ pub struct SMBTransactionIoctl { impl SMBTransactionIoctl { pub fn new(func: u32) -> Self { - return Self { - func, - }; + return Self { func }; } } impl SMBState { - pub fn new_ioctl_tx(&mut self, hdr: SMBCommonHdr, func: u32) - -> &mut SMBTransaction - { + pub fn new_ioctl_tx(&mut self, hdr: SMBCommonHdr, func: u32) -> &mut SMBTransaction { let mut tx = self.new_tx(); tx.hdr = hdr; - tx.type_data = Some(SMBTransactionTypeData::IOCTL( - SMBTransactionIoctl::new(func))); + tx.type_data = Some(SMBTransactionTypeData::IOCTL(SMBTransactionIoctl::new( + func, + ))); tx.request_done = true; tx.response_done = self.tc_trunc; // no response expected if tc is truncated - SCLogDebug!("SMB: TX IOCTL created: ID {} FUNC {:08x}: {}", - tx.id, func, &fsctl_func_to_string(func)); + SCLogDebug!( + "SMB: TX IOCTL created: ID {} FUNC {:08x}: {}", + tx.id, + func, + &fsctl_func_to_string(func) + ); self.transactions.push_back(tx); let tx_ref = self.transactions.back_mut(); return tx_ref.unwrap(); @@ -57,8 +58,7 @@ impl SMBState { } // IOCTL responses ASYNC don't set the tree id -pub fn smb2_ioctl_request_record(state: &mut SMBState, r: &Smb2Record) -{ +pub fn smb2_ioctl_request_record(state: &mut SMBState, r: &Smb2Record) { let hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_HEADER); match parse_smb2_request_ioctl(r.data) { Ok((_, rd)) => { @@ -73,21 +73,24 @@ pub fn smb2_ioctl_request_record(state: &mut SMBState, r: &Smb2Record) let vercmd = SMBVerCmdStat::new2(SMB2_COMMAND_IOCTL); smb_write_dcerpc_record(state, vercmd, hdr, rd.data); } else { - SCLogDebug!("IOCTL {:08x} {}", rd.function, &fsctl_func_to_string(rd.function)); + SCLogDebug!( + "IOCTL {:08x} {}", + rd.function, + &fsctl_func_to_string(rd.function) + ); let tx = state.new_ioctl_tx(hdr, rd.function); tx.vercmd.set_smb2_cmd(SMB2_COMMAND_IOCTL); } - }, + } _ => { let tx = state.new_generic_tx(2, r.command, hdr); tx.set_event(SMBEvent::MalformedData); - }, + } }; } // IOCTL responses ASYNC don't set the tree id -pub fn smb2_ioctl_response_record(state: &mut SMBState, r: &Smb2Record) -{ +pub fn smb2_ioctl_response_record(state: &mut SMBState, r: &Smb2Record) { let hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_HEADER); match parse_smb2_response_ioctl(r.data) { Ok((_, rd)) => { @@ -102,9 +105,12 @@ pub fn smb2_ioctl_response_record(state: &mut SMBState, r: &Smb2Record) SCLogDebug!("IOCTL response data is_pipe. Calling smb_read_dcerpc_record"); let vercmd = SMBVerCmdStat::new2_with_ntstatus(SMB2_COMMAND_IOCTL, r.nt_status); SCLogDebug!("TODO passing empty GUID"); - smb_read_dcerpc_record(state, vercmd, hdr, &[],rd.data); + smb_read_dcerpc_record(state, vercmd, hdr, &[], rd.data); } else { - SCLogDebug!("SMB2_COMMAND_IOCTL/SMB_NTSTATUS_PENDING looking for {:?}", hdr); + SCLogDebug!( + "SMB2_COMMAND_IOCTL/SMB_NTSTATUS_PENDING looking for {:?}", + hdr + ); if let Some(tx) = state.get_generic_tx(2, SMB2_COMMAND_IOCTL, &hdr) { tx.set_status(r.nt_status, false); if r.nt_status != SMB_NTSTATUS_PENDING { @@ -112,22 +118,25 @@ pub fn smb2_ioctl_response_record(state: &mut SMBState, r: &Smb2Record) } } } - }, + } _ => { - SCLogDebug!("SMB2_COMMAND_IOCTL/SMB_NTSTATUS_PENDING looking for {:?}", hdr); + SCLogDebug!( + "SMB2_COMMAND_IOCTL/SMB_NTSTATUS_PENDING looking for {:?}", + hdr + ); if let Some(tx) = state.get_generic_tx(2, SMB2_COMMAND_IOCTL, &hdr) { SCLogDebug!("updated status of tx {}", tx.id); tx.set_status(r.nt_status, false); if r.nt_status != SMB_NTSTATUS_PENDING { tx.response_done = true; } - + // parsing failed for 'SUCCESS' record, set event if r.nt_status == SMB_NTSTATUS_SUCCESS { SCLogDebug!("parse fail {:?}", r); tx.set_event(SMBEvent::MalformedData); } } - }, + } }; } diff --git a/rust/src/smb/smb2_session.rs b/rust/src/smb/smb2_session.rs index 93cc99cdd4c6..ef6aba5bfb97 100644 --- a/rust/src/smb/smb2_session.rs +++ b/rust/src/smb/smb2_session.rs @@ -15,13 +15,12 @@ * 02110-1301, USA. */ -use crate::smb::smb2_records::*; -use crate::smb::smb::*; -use crate::smb::events::*; use crate::smb::auth::*; +use crate::smb::events::*; +use crate::smb::smb::*; +use crate::smb::smb2_records::*; -pub fn smb2_session_setup_request(state: &mut SMBState, r: &Smb2Record) -{ +pub fn smb2_session_setup_request(state: &mut SMBState, r: &Smb2Record) { SCLogDebug!("SMB2_COMMAND_SESSION_SETUP: r.data.len() {}", r.data.len()); #[allow(clippy::single_match)] match parse_smb2_request_session_setup(r.data) { @@ -41,45 +40,40 @@ pub fn smb2_session_setup_request(state: &mut SMBState, r: &Smb2Record) } } } - }, - _ => { -// events.push(SMBEvent::MalformedData); - }, + } + _ => { + // events.push(SMBEvent::MalformedData); + } } } -fn smb2_session_setup_update_tx(tx: &mut SMBTransaction, r: &Smb2Record) -{ +fn smb2_session_setup_update_tx(tx: &mut SMBTransaction, r: &Smb2Record) { tx.hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_HEADER); // to overwrite ssn_id 0 tx.set_status(r.nt_status, false); tx.response_done = true; } -pub fn smb2_session_setup_response(state: &mut SMBState, r: &Smb2Record) -{ +pub fn smb2_session_setup_response(state: &mut SMBState, r: &Smb2Record) { // try exact match with session id already set (e.g. NTLMSSP AUTH phase) - let found = r.session_id != 0 && match state.get_sessionsetup_tx( - SMBCommonHdr::from2(r, SMBHDR_TYPE_HEADER)) - { - Some(tx) => { - smb2_session_setup_update_tx(tx, r); - SCLogDebug!("smb2_session_setup_response: tx {:?}", tx); - true - }, - None => { false }, - }; + let found = r.session_id != 0 + && match state.get_sessionsetup_tx(SMBCommonHdr::from2(r, SMBHDR_TYPE_HEADER)) { + Some(tx) => { + smb2_session_setup_update_tx(tx, r); + SCLogDebug!("smb2_session_setup_response: tx {:?}", tx); + true + } + None => false, + }; // otherwise try match with ssn id 0 (e.g. NTLMSSP_NEGOTIATE) if !found { - match state.get_sessionsetup_tx( - SMBCommonHdr::new(SMBHDR_TYPE_HEADER, 0, 0, r.message_id)) - { + match state.get_sessionsetup_tx(SMBCommonHdr::new(SMBHDR_TYPE_HEADER, 0, 0, r.message_id)) { Some(tx) => { smb2_session_setup_update_tx(tx, r); SCLogDebug!("smb2_session_setup_response: tx {:?}", tx); - }, + } None => { SCLogDebug!("smb2_session_setup_response: tx not found for {:?}", r); - }, + } } } } diff --git a/rust/src/smb/smb3.rs b/rust/src/smb/smb3.rs index 07a705995502..c83d6cb2d9d4 100644 --- a/rust/src/smb/smb3.rs +++ b/rust/src/smb/smb3.rs @@ -19,11 +19,11 @@ use nom7::bytes::streaming::{tag, take}; use nom7::number::streaming::{le_u16, le_u32, le_u64}; use nom7::IResult; -#[derive(Debug,PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct Smb3TransformRecord<'a> { pub session_id: u64, pub enc_algo: u16, - pub enc_data: &'a[u8], + pub enc_data: &'a [u8], } pub fn parse_smb3_transform_record(i: &[u8]) -> IResult<&[u8], Smb3TransformRecord> { @@ -46,8 +46,8 @@ pub fn parse_smb3_transform_record(i: &[u8]) -> IResult<&[u8], Smb3TransformReco #[cfg(test)] mod tests { use super::*; - #[test] - fn test_parse_smb3_transform_record() { + #[test] + fn test_parse_smb3_transform_record() { // https://raw.githubusercontent.com/bro/bro/master/testing/btest/Traces/smb/smb3.pcap let data = hex::decode("fd534d42188d39cea4b1e3f640aff5d0b1569852c0bd665516dbb4b499507f000000000069000000000001003d00009400480000d9f8a66572b40c621bea6f5922a412a8eb2e3cc2af9ce26a277e75898cb523b9eb49ef660a6a1a09368fadd6a58e893e08eb3b7c068bdb74b6cd38e9ed1a2559cefb2ebc2172fd86c08a1a636eb851f20bf53a242f4cfaf7ab44e77291073ad492d6297c3d3a67757c").unwrap(); let result = parse_smb3_transform_record(&data).unwrap(); diff --git a/rust/src/smb/smb_records.rs b/rust/src/smb/smb_records.rs index cc5b3cb7a210..f11b3ac8c78f 100644 --- a/rust/src/smb/smb_records.rs +++ b/rust/src/smb/smb_records.rs @@ -22,22 +22,21 @@ use nom7::{Err, IResult}; /// parse a UTF16 string that is null terminated. Normally by 2 null /// bytes, but at the end of the data it can also be a single null. /// Skip every second byte. -pub fn smb_get_unicode_string(blob: &[u8]) -> IResult<&[u8], Vec, SmbError> -{ +pub fn smb_get_unicode_string(blob: &[u8]) -> IResult<&[u8], Vec, SmbError> { SCLogDebug!("get_unicode_string: blob {} {:?}", blob.len(), blob); - let mut name : Vec = Vec::new(); + let mut name: Vec = Vec::new(); let mut c = blob; while !c.is_empty() { if c.len() == 1 && c[0] == 0 { let rem = &c[1..]; SCLogDebug!("get_unicode_string: name {:?}", name); - return Ok((rem, name)) + return Ok((rem, name)); } else if c.len() == 1 { break; } else if c[0] == 0 && c[1] == 0 { let rem = &c[2..]; SCLogDebug!("get_unicode_string: name {:?}", name); - return Ok((rem, name)) + return Ok((rem, name)); } name.push(c[0]); c = &c[2..]; @@ -50,4 +49,3 @@ pub fn smb_get_ascii_string(i: &[u8]) -> IResult<&[u8], Vec, SmbError> { let (i, s) = take_until_and_consume(b"\x00")(i)?; Ok((i, s.to_vec())) } - diff --git a/rust/src/smb/smb_status.rs b/rust/src/smb/smb_status.rs index 10b06a56cf60..61eaf742ac4f 100644 --- a/rust/src/smb/smb_status.rs +++ b/rust/src/smb/smb_status.rs @@ -15,3595 +15,4139 @@ * 02110-1301, USA. */ -pub const SMB_NTSTATUS_SUCCESS: u32 = 0x00000000; -pub const SMB_NTSTATUS_WAIT_1: u32 = 0x00000001; -pub const SMB_NTSTATUS_WAIT_2: u32 = 0x00000002; -pub const SMB_NTSTATUS_WAIT_3: u32 = 0x00000003; -pub const SMB_NTSTATUS_WAIT_63: u32 = 0x0000003f; -pub const SMB_NTSTATUS_ABANDONED: u32 = 0x00000080; -pub const SMB_NTSTATUS_ABANDONED_WAIT_63: u32 = 0x000000bf; -pub const SMB_NTSTATUS_USER_APC: u32 = 0x000000c0; -pub const SMB_NTSTATUS_ALERTED: u32 = 0x00000101; -pub const SMB_NTSTATUS_TIMEOUT: u32 = 0x00000102; -pub const SMB_NTSTATUS_PENDING: u32 = 0x00000103; -pub const SMB_NTSTATUS_REPARSE: u32 = 0x00000104; -pub const SMB_NTSTATUS_MORE_ENTRIES: u32 = 0x00000105; -pub const SMB_NTSTATUS_NOT_ALL_ASSIGNED: u32 = 0x00000106; -pub const SMB_NTSTATUS_SOME_NOT_MAPPED: u32 = 0x00000107; -pub const SMB_NTSTATUS_OPLOCK_BREAK_IN_PROGRESS: u32 = 0x00000108; -pub const SMB_NTSTATUS_VOLUME_MOUNTED: u32 = 0x00000109; -pub const SMB_NTSTATUS_RXACT_COMMITTED: u32 = 0x0000010a; -pub const SMB_NTSTATUS_NOTIFY_CLEANUP: u32 = 0x0000010b; -pub const SMB_NTSTATUS_NOTIFY_ENUM_DIR: u32 = 0x0000010c; -pub const SMB_NTSTATUS_NO_QUOTAS_FOR_ACCOUNT: u32 = 0x0000010d; -pub const SMB_NTSTATUS_PRIMARY_TRANSPORT_CONNECT_FAILED: u32 = 0x0000010e; -pub const SMB_NTSTATUS_PAGE_FAULT_TRANSITION: u32 = 0x00000110; -pub const SMB_NTSTATUS_PAGE_FAULT_DEMAND_ZERO: u32 = 0x00000111; -pub const SMB_NTSTATUS_PAGE_FAULT_COPY_ON_WRITE: u32 = 0x00000112; -pub const SMB_NTSTATUS_PAGE_FAULT_GUARD_PAGE: u32 = 0x00000113; -pub const SMB_NTSTATUS_PAGE_FAULT_PAGING_FILE: u32 = 0x00000114; -pub const SMB_NTSTATUS_CACHE_PAGE_LOCKED: u32 = 0x00000115; -pub const SMB_NTSTATUS_CRASH_DUMP: u32 = 0x00000116; -pub const SMB_NTSTATUS_BUFFER_ALL_ZEROS: u32 = 0x00000117; -pub const SMB_NTSTATUS_REPARSE_OBJECT: u32 = 0x00000118; -pub const SMB_NTSTATUS_RESOURCE_REQUIREMENTS_CHANGED: u32 = 0x00000119; -pub const SMB_NTSTATUS_TRANSLATION_COMPLETE: u32 = 0x00000120; -pub const SMB_NTSTATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY: u32 = 0x00000121; -pub const SMB_NTSTATUS_NOTHING_TO_TERMINATE: u32 = 0x00000122; -pub const SMB_NTSTATUS_PROCESS_NOT_IN_JOB: u32 = 0x00000123; -pub const SMB_NTSTATUS_PROCESS_IN_JOB: u32 = 0x00000124; -pub const SMB_NTSTATUS_VOLSNAP_HIBERNATE_READY: u32 = 0x00000125; -pub const SMB_NTSTATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY: u32 = 0x00000126; -pub const SMB_NTSTATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED: u32 = 0x00000127; -pub const SMB_NTSTATUS_INTERRUPT_STILL_CONNECTED: u32 = 0x00000128; -pub const SMB_NTSTATUS_PROCESS_CLONED: u32 = 0x00000129; -pub const SMB_NTSTATUS_FILE_LOCKED_WITH_ONLY_READERS: u32 = 0x0000012a; -pub const SMB_NTSTATUS_FILE_LOCKED_WITH_WRITERS: u32 = 0x0000012b; -pub const SMB_NTSTATUS_RESOURCEMANAGER_READ_ONLY: u32 = 0x00000202; -pub const SMB_NTSTATUS_WAIT_FOR_OPLOCK: u32 = 0x00000367; -pub const SMB_NTDBG_EXCEPTION_HANDLED: u32 = 0x00010001; -pub const SMB_NTDBG_CONTINUE: u32 = 0x00010002; -pub const SMB_NTSTATUS_FLT_IO_COMPLETE: u32 = 0x001c0001; -pub const SMB_NTSTATUS_FILE_NOT_AVAILABLE: u32 = 0xc0000467; -pub const SMB_NTSTATUS_SHARE_UNAVAILABLE: u32 = 0xc0000480; -pub const SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_AFFINITY: u32 = 0xc0000721; -pub const SMB_NTSTATUS_OBJECT_NAME_EXISTS: u32 = 0x40000000; -pub const SMB_NTSTATUS_THREAD_WAS_SUSPENDED: u32 = 0x40000001; -pub const SMB_NTSTATUS_WORKING_SET_LIMIT_RANGE: u32 = 0x40000002; -pub const SMB_NTSTATUS_IMAGE_NOT_AT_BASE: u32 = 0x40000003; -pub const SMB_NTSTATUS_RXACT_STATE_CREATED: u32 = 0x40000004; -pub const SMB_NTSTATUS_SEGMENT_NOTIFICATION: u32 = 0x40000005; -pub const SMB_NTSTATUS_LOCAL_USER_SESSION_KEY: u32 = 0x40000006; -pub const SMB_NTSTATUS_BAD_CURRENT_DIRECTORY: u32 = 0x40000007; -pub const SMB_NTSTATUS_SERIAL_MORE_WRITES: u32 = 0x40000008; -pub const SMB_NTSTATUS_REGISTRY_RECOVERED: u32 = 0x40000009; -pub const SMB_NTSTATUS_FT_READ_RECOVERY_FROM_BACKUP: u32 = 0x4000000a; -pub const SMB_NTSTATUS_FT_WRITE_RECOVERY: u32 = 0x4000000b; -pub const SMB_NTSTATUS_SERIAL_COUNTER_TIMEOUT: u32 = 0x4000000c; -pub const SMB_NTSTATUS_NULL_LM_PASSWORD: u32 = 0x4000000d; -pub const SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH: u32 = 0x4000000e; -pub const SMB_NTSTATUS_RECEIVE_PARTIAL: u32 = 0x4000000f; -pub const SMB_NTSTATUS_RECEIVE_EXPEDITED: u32 = 0x40000010; -pub const SMB_NTSTATUS_RECEIVE_PARTIAL_EXPEDITED: u32 = 0x40000011; -pub const SMB_NTSTATUS_EVENT_DONE: u32 = 0x40000012; -pub const SMB_NTSTATUS_EVENT_PENDING: u32 = 0x40000013; -pub const SMB_NTSTATUS_CHECKING_FILE_SYSTEM: u32 = 0x40000014; -pub const SMB_NTSTATUS_FATAL_APP_EXIT: u32 = 0x40000015; -pub const SMB_NTSTATUS_PREDEFINED_HANDLE: u32 = 0x40000016; -pub const SMB_NTSTATUS_WAS_UNLOCKED: u32 = 0x40000017; -pub const SMB_NTSTATUS_SERVICE_NOTIFICATION: u32 = 0x40000018; -pub const SMB_NTSTATUS_WAS_LOCKED: u32 = 0x40000019; -pub const SMB_NTSTATUS_LOG_HARD_ERROR: u32 = 0x4000001a; -pub const SMB_NTSTATUS_ALREADY_WIN32: u32 = 0x4000001b; -pub const SMB_NTSTATUS_WX86_UNSIMULATE: u32 = 0x4000001c; -pub const SMB_NTSTATUS_WX86_CONTINUE: u32 = 0x4000001d; -pub const SMB_NTSTATUS_WX86_SINGLE_STEP: u32 = 0x4000001e; -pub const SMB_NTSTATUS_WX86_BREAKPOINT: u32 = 0x4000001f; -pub const SMB_NTSTATUS_WX86_EXCEPTION_CONTINUE: u32 = 0x40000020; -pub const SMB_NTSTATUS_WX86_EXCEPTION_LASTCHANCE: u32 = 0x40000021; -pub const SMB_NTSTATUS_WX86_EXCEPTION_CHAIN: u32 = 0x40000022; -pub const SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE: u32 = 0x40000023; -pub const SMB_NTSTATUS_NO_YIELD_PERFORMED: u32 = 0x40000024; -pub const SMB_NTSTATUS_TIMER_RESUME_IGNORED: u32 = 0x40000025; -pub const SMB_NTSTATUS_ARBITRATION_UNHANDLED: u32 = 0x40000026; -pub const SMB_NTSTATUS_CARDBUS_NOT_SUPPORTED: u32 = 0x40000027; -pub const SMB_NTSTATUS_WX86_CREATEWX86TIB: u32 = 0x40000028; -pub const SMB_NTSTATUS_MP_PROCESSOR_MISMATCH: u32 = 0x40000029; -pub const SMB_NTSTATUS_HIBERNATED: u32 = 0x4000002a; -pub const SMB_NTSTATUS_RESUME_HIBERNATION: u32 = 0x4000002b; -pub const SMB_NTSTATUS_FIRMWARE_UPDATED: u32 = 0x4000002c; -pub const SMB_NTSTATUS_DRIVERS_LEAKING_LOCKED_PAGES: u32 = 0x4000002d; -pub const SMB_NTSTATUS_MESSAGE_RETRIEVED: u32 = 0x4000002e; -pub const SMB_NTSTATUS_SYSTEM_POWERSTATE_TRANSITION: u32 = 0x4000002f; -pub const SMB_NTSTATUS_ALPC_CHECK_COMPLETION_LIST: u32 = 0x40000030; -pub const SMB_NTSTATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: u32 = 0x40000031; -pub const SMB_NTSTATUS_ACCESS_AUDIT_BY_POLICY: u32 = 0x40000032; -pub const SMB_NTSTATUS_ABANDON_HIBERFILE: u32 = 0x40000033; -pub const SMB_NTSTATUS_BIZRULES_NOT_ENABLED: u32 = 0x40000034; -pub const SMB_NTSTATUS_WAKE_SYSTEM: u32 = 0x40000294; -pub const SMB_NTSTATUS_DS_SHUTTING_DOWN: u32 = 0x40000370; -pub const SMB_NTDBG_REPLY_LATER: u32 = 0x40010001; -pub const SMB_NTDBG_UNABLE_TO_PROVIDE_HANDLE: u32 = 0x40010002; -pub const SMB_NTDBG_TERMINATE_THREAD: u32 = 0x40010003; -pub const SMB_NTDBG_TERMINATE_PROCESS: u32 = 0x40010004; -pub const SMB_NTDBG_CONTROL_C: u32 = 0x40010005; -pub const SMB_NTDBG_PRINTEXCEPTION_C: u32 = 0x40010006; -pub const SMB_NTDBG_RIPEXCEPTION: u32 = 0x40010007; -pub const SMB_NTDBG_CONTROL_BREAK: u32 = 0x40010008; -pub const SMB_NTDBG_COMMAND_EXCEPTION: u32 = 0x40010009; -pub const SMB_NTRPC_NT_UUID_LOCAL_ONLY: u32 = 0x40020056; -pub const SMB_NTRPC_NT_SEND_INCOMPLETE: u32 = 0x400200af; -pub const SMB_NTSTATUS_CTX_CDM_CONNECT: u32 = 0x400a0004; -pub const SMB_NTSTATUS_CTX_CDM_DISCONNECT: u32 = 0x400a0005; -pub const SMB_NTSTATUS_SXS_RELEASE_ACTIVATION_CONTEXT: u32 = 0x4015000d; -pub const SMB_NTSTATUS_RECOVERY_NOT_NEEDED: u32 = 0x40190034; -pub const SMB_NTSTATUS_RM_ALREADY_STARTED: u32 = 0x40190035; -pub const SMB_NTSTATUS_LOG_NO_RESTART: u32 = 0x401a000c; -pub const SMB_NTSTATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST: u32 = 0x401b00ec; -pub const SMB_NTSTATUS_GRAPHICS_PARTIAL_DATA_POPULATED: u32 = 0x401e000a; -pub const SMB_NTSTATUS_GRAPHICS_DRIVER_MISMATCH: u32 = 0x401e0117; -pub const SMB_NTSTATUS_GRAPHICS_MODE_NOT_PINNED: u32 = 0x401e0307; -pub const SMB_NTSTATUS_GRAPHICS_NO_PREFERRED_MODE: u32 = 0x401e031e; -pub const SMB_NTSTATUS_GRAPHICS_DATASET_IS_EMPTY: u32 = 0x401e034b; -pub const SMB_NTSTATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: u32 = 0x401e034c; -pub const SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: u32 = 0x401e0351; -pub const SMB_NTSTATUS_GRAPHICS_UNKNOWN_CHILD_STATUS: u32 = 0x401e042f; -pub const SMB_NTSTATUS_GRAPHICS_LEADLINK_START_DEFERRED: u32 = 0x401e0437; -pub const SMB_NTSTATUS_GRAPHICS_POLLING_TOO_FREQUENTLY: u32 = 0x401e0439; -pub const SMB_NTSTATUS_GRAPHICS_START_DEFERRED: u32 = 0x401e043a; -pub const SMB_NTSTATUS_NDIS_INDICATION_REQUIRED: u32 = 0x40230001; -pub const SMB_NTSTATUS_GUARD_PAGE_VIOLATION: u32 = 0x80000001; -pub const SMB_NTSTATUS_DATATYPE_MISALIGNMENT: u32 = 0x80000002; -pub const SMB_NTSTATUS_BREAKPOINT: u32 = 0x80000003; -pub const SMB_NTSTATUS_SINGLE_STEP: u32 = 0x80000004; -pub const SMB_NTSTATUS_BUFFER_OVERFLOW: u32 = 0x80000005; -pub const SMB_NTSTATUS_NO_MORE_FILES: u32 = 0x80000006; -pub const SMB_NTSTATUS_WAKE_SYSTEM_DEBUGGER: u32 = 0x80000007; -pub const SMB_NTSTATUS_HANDLES_CLOSED: u32 = 0x8000000a; -pub const SMB_NTSTATUS_NO_INHERITANCE: u32 = 0x8000000b; -pub const SMB_NTSTATUS_GUID_SUBSTITUTION_MADE: u32 = 0x8000000c; -pub const SMB_NTSTATUS_PARTIAL_COPY: u32 = 0x8000000d; -pub const SMB_NTSTATUS_DEVICE_PAPER_EMPTY: u32 = 0x8000000e; -pub const SMB_NTSTATUS_DEVICE_POWERED_OFF: u32 = 0x8000000f; -pub const SMB_NTSTATUS_DEVICE_OFF_LINE: u32 = 0x80000010; -pub const SMB_NTSTATUS_DEVICE_BUSY: u32 = 0x80000011; -pub const SMB_NTSTATUS_NO_MORE_EAS: u32 = 0x80000012; -pub const SMB_NTSTATUS_INVALID_EA_NAME: u32 = 0x80000013; -pub const SMB_NTSTATUS_EA_LIST_INCONSISTENT: u32 = 0x80000014; -pub const SMB_NTSTATUS_INVALID_EA_FLAG: u32 = 0x80000015; -pub const SMB_NTSTATUS_VERIFY_REQUIRED: u32 = 0x80000016; -pub const SMB_NTSTATUS_EXTRANEOUS_INFORMATION: u32 = 0x80000017; -pub const SMB_NTSTATUS_RXACT_COMMIT_NECESSARY: u32 = 0x80000018; -pub const SMB_NTSTATUS_NO_MORE_ENTRIES: u32 = 0x8000001a; -pub const SMB_NTSTATUS_FILEMARK_DETECTED: u32 = 0x8000001b; -pub const SMB_NTSTATUS_MEDIA_CHANGED: u32 = 0x8000001c; -pub const SMB_NTSTATUS_BUS_RESET: u32 = 0x8000001d; -pub const SMB_NTSTATUS_END_OF_MEDIA: u32 = 0x8000001e; -pub const SMB_NTSTATUS_BEGINNING_OF_MEDIA: u32 = 0x8000001f; -pub const SMB_NTSTATUS_MEDIA_CHECK: u32 = 0x80000020; -pub const SMB_NTSTATUS_SETMARK_DETECTED: u32 = 0x80000021; -pub const SMB_NTSTATUS_NO_DATA_DETECTED: u32 = 0x80000022; -pub const SMB_NTSTATUS_REDIRECTOR_HAS_OPEN_HANDLES: u32 = 0x80000023; -pub const SMB_NTSTATUS_SERVER_HAS_OPEN_HANDLES: u32 = 0x80000024; -pub const SMB_NTSTATUS_ALREADY_DISCONNECTED: u32 = 0x80000025; -pub const SMB_NTSTATUS_LONGJUMP: u32 = 0x80000026; -pub const SMB_NTSTATUS_CLEANER_CARTRIDGE_INSTALLED: u32 = 0x80000027; -pub const SMB_NTSTATUS_PLUGPLAY_QUERY_VETOED: u32 = 0x80000028; -pub const SMB_NTSTATUS_UNWIND_CONSOLIDATE: u32 = 0x80000029; -pub const SMB_NTSTATUS_REGISTRY_HIVE_RECOVERED: u32 = 0x8000002a; -pub const SMB_NTSTATUS_DLL_MIGHT_BE_INSECURE: u32 = 0x8000002b; -pub const SMB_NTSTATUS_DLL_MIGHT_BE_INCOMPATIBLE: u32 = 0x8000002c; -pub const SMB_NTSTATUS_STOPPED_ON_SYMLINK: u32 = 0x8000002d; -pub const SMB_NTSTATUS_DEVICE_REQUIRES_CLEANING: u32 = 0x80000288; -pub const SMB_NTSTATUS_DEVICE_DOOR_OPEN: u32 = 0x80000289; -pub const SMB_NTSTATUS_DATA_LOST_REPAIR: u32 = 0x80000803; -pub const SMB_NTDBG_EXCEPTION_NOT_HANDLED: u32 = 0x80010001; -pub const SMB_NTSTATUS_CLUSTER_NODE_ALREADY_UP: u32 = 0x80130001; -pub const SMB_NTSTATUS_CLUSTER_NODE_ALREADY_DOWN: u32 = 0x80130002; -pub const SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_ONLINE: u32 = 0x80130003; -pub const SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_OFFLINE: u32 = 0x80130004; -pub const SMB_NTSTATUS_CLUSTER_NODE_ALREADY_MEMBER: u32 = 0x80130005; -pub const SMB_NTSTATUS_COULD_NOT_RESIZE_LOG: u32 = 0x80190009; -pub const SMB_NTSTATUS_NO_TXF_METADATA: u32 = 0x80190029; -pub const SMB_NTSTATUS_CANT_RECOVER_WITH_HANDLE_OPEN: u32 = 0x80190031; -pub const SMB_NTSTATUS_TXF_METADATA_ALREADY_PRESENT: u32 = 0x80190041; -pub const SMB_NTSTATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: u32 = 0x80190042; -pub const SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED: u32 = 0x801b00eb; -pub const SMB_NTSTATUS_FLT_BUFFER_TOO_SMALL: u32 = 0x801c0001; -pub const SMB_NTSTATUS_FVE_PARTIAL_METADATA: u32 = 0x80210001; -pub const SMB_NTSTATUS_FVE_TRANSIENT_STATE: u32 = 0x80210002; -pub const SMB_NTSTATUS_UNSUCCESSFUL: u32 = 0xc0000001; -pub const SMB_NTSTATUS_NOT_IMPLEMENTED: u32 = 0xc0000002; -pub const SMB_NTSTATUS_INVALID_INFO_CLASS: u32 = 0xc0000003; -pub const SMB_NTSTATUS_INFO_LENGTH_MISMATCH: u32 = 0xc0000004; -pub const SMB_NTSTATUS_ACCESS_VIOLATION: u32 = 0xc0000005; -pub const SMB_NTSTATUS_IN_PAGE_ERROR: u32 = 0xc0000006; -pub const SMB_NTSTATUS_PAGEFILE_QUOTA: u32 = 0xc0000007; -pub const SMB_NTSTATUS_INVALID_HANDLE: u32 = 0xc0000008; -pub const SMB_NTSTATUS_BAD_INITIAL_STACK: u32 = 0xc0000009; -pub const SMB_NTSTATUS_BAD_INITIAL_PC: u32 = 0xc000000a; -pub const SMB_NTSTATUS_INVALID_CID: u32 = 0xc000000b; -pub const SMB_NTSTATUS_TIMER_NOT_CANCELED: u32 = 0xc000000c; -pub const SMB_NTSTATUS_INVALID_PARAMETER: u32 = 0xc000000d; -pub const SMB_NTSTATUS_NO_SUCH_DEVICE: u32 = 0xc000000e; -pub const SMB_NTSTATUS_NO_SUCH_FILE: u32 = 0xc000000f; -pub const SMB_NTSTATUS_INVALID_DEVICE_REQUEST: u32 = 0xc0000010; -pub const SMB_NTSTATUS_END_OF_FILE: u32 = 0xc0000011; -pub const SMB_NTSTATUS_WRONG_VOLUME: u32 = 0xc0000012; -pub const SMB_NTSTATUS_NO_MEDIA_IN_DEVICE: u32 = 0xc0000013; -pub const SMB_NTSTATUS_UNRECOGNIZED_MEDIA: u32 = 0xc0000014; -pub const SMB_NTSTATUS_NONEXISTENT_SECTOR: u32 = 0xc0000015; -pub const SMB_NTSTATUS_MORE_PROCESSING_REQUIRED: u32 = 0xc0000016; -pub const SMB_NTSTATUS_NO_MEMORY: u32 = 0xc0000017; -pub const SMB_NTSTATUS_CONFLICTING_ADDRESSES: u32 = 0xc0000018; -pub const SMB_NTSTATUS_NOT_MAPPED_VIEW: u32 = 0xc0000019; -pub const SMB_NTSTATUS_UNABLE_TO_FREE_VM: u32 = 0xc000001a; -pub const SMB_NTSTATUS_UNABLE_TO_DELETE_SECTION: u32 = 0xc000001b; -pub const SMB_NTSTATUS_INVALID_SYSTEM_SERVICE: u32 = 0xc000001c; -pub const SMB_NTSTATUS_ILLEGAL_INSTRUCTION: u32 = 0xc000001d; -pub const SMB_NTSTATUS_INVALID_LOCK_SEQUENCE: u32 = 0xc000001e; -pub const SMB_NTSTATUS_INVALID_VIEW_SIZE: u32 = 0xc000001f; -pub const SMB_NTSTATUS_INVALID_FILE_FOR_SECTION: u32 = 0xc0000020; -pub const SMB_NTSTATUS_ALREADY_COMMITTED: u32 = 0xc0000021; -pub const SMB_NTSTATUS_ACCESS_DENIED: u32 = 0xc0000022; -pub const SMB_NTSTATUS_BUFFER_TOO_SMALL: u32 = 0xc0000023; -pub const SMB_NTSTATUS_OBJECT_TYPE_MISMATCH: u32 = 0xc0000024; -pub const SMB_NTSTATUS_NONCONTINUABLE_EXCEPTION: u32 = 0xc0000025; -pub const SMB_NTSTATUS_INVALID_DISPOSITION: u32 = 0xc0000026; -pub const SMB_NTSTATUS_UNWIND: u32 = 0xc0000027; -pub const SMB_NTSTATUS_BAD_STACK: u32 = 0xc0000028; -pub const SMB_NTSTATUS_INVALID_UNWIND_TARGET: u32 = 0xc0000029; -pub const SMB_NTSTATUS_NOT_LOCKED: u32 = 0xc000002a; -pub const SMB_NTSTATUS_PARITY_ERROR: u32 = 0xc000002b; -pub const SMB_NTSTATUS_UNABLE_TO_DECOMMIT_VM: u32 = 0xc000002c; -pub const SMB_NTSTATUS_NOT_COMMITTED: u32 = 0xc000002d; -pub const SMB_NTSTATUS_INVALID_PORT_ATTRIBUTES: u32 = 0xc000002e; -pub const SMB_NTSTATUS_PORT_MESSAGE_TOO_LONG: u32 = 0xc000002f; -pub const SMB_NTSTATUS_INVALID_PARAMETER_MIX: u32 = 0xc0000030; -pub const SMB_NTSTATUS_INVALID_QUOTA_LOWER: u32 = 0xc0000031; -pub const SMB_NTSTATUS_DISK_CORRUPT_ERROR: u32 = 0xc0000032; -pub const SMB_NTSTATUS_OBJECT_NAME_INVALID: u32 = 0xc0000033; -pub const SMB_NTSTATUS_OBJECT_NAME_NOT_FOUND: u32 = 0xc0000034; -pub const SMB_NTSTATUS_OBJECT_NAME_COLLISION: u32 = 0xc0000035; -pub const SMB_NTSTATUS_PORT_DISCONNECTED: u32 = 0xc0000037; -pub const SMB_NTSTATUS_DEVICE_ALREADY_ATTACHED: u32 = 0xc0000038; -pub const SMB_NTSTATUS_OBJECT_PATH_INVALID: u32 = 0xc0000039; -pub const SMB_NTSTATUS_OBJECT_PATH_NOT_FOUND: u32 = 0xc000003a; -pub const SMB_NTSTATUS_OBJECT_PATH_SYNTAX_BAD: u32 = 0xc000003b; -pub const SMB_NTSTATUS_DATA_OVERRUN: u32 = 0xc000003c; -pub const SMB_NTSTATUS_DATA_LATE_ERROR: u32 = 0xc000003d; -pub const SMB_NTSTATUS_DATA_ERROR: u32 = 0xc000003e; -pub const SMB_NTSTATUS_CRC_ERROR: u32 = 0xc000003f; -pub const SMB_NTSTATUS_SECTION_TOO_BIG: u32 = 0xc0000040; -pub const SMB_NTSTATUS_PORT_CONNECTION_REFUSED: u32 = 0xc0000041; -pub const SMB_NTSTATUS_INVALID_PORT_HANDLE: u32 = 0xc0000042; -pub const SMB_NTSTATUS_SHARING_VIOLATION: u32 = 0xc0000043; -pub const SMB_NTSTATUS_QUOTA_EXCEEDED: u32 = 0xc0000044; -pub const SMB_NTSTATUS_INVALID_PAGE_PROTECTION: u32 = 0xc0000045; -pub const SMB_NTSTATUS_MUTANT_NOT_OWNED: u32 = 0xc0000046; -pub const SMB_NTSTATUS_SEMAPHORE_LIMIT_EXCEEDED: u32 = 0xc0000047; -pub const SMB_NTSTATUS_PORT_ALREADY_SET: u32 = 0xc0000048; -pub const SMB_NTSTATUS_SECTION_NOT_IMAGE: u32 = 0xc0000049; -pub const SMB_NTSTATUS_SUSPEND_COUNT_EXCEEDED: u32 = 0xc000004a; -pub const SMB_NTSTATUS_THREAD_IS_TERMINATING: u32 = 0xc000004b; -pub const SMB_NTSTATUS_BAD_WORKING_SET_LIMIT: u32 = 0xc000004c; -pub const SMB_NTSTATUS_INCOMPATIBLE_FILE_MAP: u32 = 0xc000004d; -pub const SMB_NTSTATUS_SECTION_PROTECTION: u32 = 0xc000004e; -pub const SMB_NTSTATUS_EAS_NOT_SUPPORTED: u32 = 0xc000004f; -pub const SMB_NTSTATUS_EA_TOO_LARGE: u32 = 0xc0000050; -pub const SMB_NTSTATUS_NONEXISTENT_EA_ENTRY: u32 = 0xc0000051; -pub const SMB_NTSTATUS_NO_EAS_ON_FILE: u32 = 0xc0000052; -pub const SMB_NTSTATUS_EA_CORRUPT_ERROR: u32 = 0xc0000053; -pub const SMB_NTSTATUS_FILE_LOCK_CONFLICT: u32 = 0xc0000054; -pub const SMB_NTSTATUS_LOCK_NOT_GRANTED: u32 = 0xc0000055; -pub const SMB_NTSTATUS_DELETE_PENDING: u32 = 0xc0000056; -pub const SMB_NTSTATUS_CTL_FILE_NOT_SUPPORTED: u32 = 0xc0000057; -pub const SMB_NTSTATUS_UNKNOWN_REVISION: u32 = 0xc0000058; -pub const SMB_NTSTATUS_REVISION_MISMATCH: u32 = 0xc0000059; -pub const SMB_NTSTATUS_INVALID_OWNER: u32 = 0xc000005a; -pub const SMB_NTSTATUS_INVALID_PRIMARY_GROUP: u32 = 0xc000005b; -pub const SMB_NTSTATUS_NO_IMPERSONATION_TOKEN: u32 = 0xc000005c; -pub const SMB_NTSTATUS_CANT_DISABLE_MANDATORY: u32 = 0xc000005d; -pub const SMB_NTSTATUS_NO_LOGON_SERVERS: u32 = 0xc000005e; -pub const SMB_NTSTATUS_NO_SUCH_LOGON_SESSION: u32 = 0xc000005f; -pub const SMB_NTSTATUS_NO_SUCH_PRIVILEGE: u32 = 0xc0000060; -pub const SMB_NTSTATUS_PRIVILEGE_NOT_HELD: u32 = 0xc0000061; -pub const SMB_NTSTATUS_INVALID_ACCOUNT_NAME: u32 = 0xc0000062; -pub const SMB_NTSTATUS_USER_EXISTS: u32 = 0xc0000063; -pub const SMB_NTSTATUS_NO_SUCH_USER: u32 = 0xc0000064; -pub const SMB_NTSTATUS_GROUP_EXISTS: u32 = 0xc0000065; -pub const SMB_NTSTATUS_NO_SUCH_GROUP: u32 = 0xc0000066; -pub const SMB_NTSTATUS_MEMBER_IN_GROUP: u32 = 0xc0000067; -pub const SMB_NTSTATUS_MEMBER_NOT_IN_GROUP: u32 = 0xc0000068; -pub const SMB_NTSTATUS_LAST_ADMIN: u32 = 0xc0000069; -pub const SMB_NTSTATUS_WRONG_PASSWORD: u32 = 0xc000006a; -pub const SMB_NTSTATUS_ILL_FORMED_PASSWORD: u32 = 0xc000006b; -pub const SMB_NTSTATUS_PASSWORD_RESTRICTION: u32 = 0xc000006c; -pub const SMB_NTSTATUS_LOGON_FAILURE: u32 = 0xc000006d; -pub const SMB_NTSTATUS_ACCOUNT_RESTRICTION: u32 = 0xc000006e; -pub const SMB_NTSTATUS_INVALID_LOGON_HOURS: u32 = 0xc000006f; -pub const SMB_NTSTATUS_INVALID_WORKSTATION: u32 = 0xc0000070; -pub const SMB_NTSTATUS_PASSWORD_EXPIRED: u32 = 0xc0000071; -pub const SMB_NTSTATUS_ACCOUNT_DISABLED: u32 = 0xc0000072; -pub const SMB_NTSTATUS_NONE_MAPPED: u32 = 0xc0000073; -pub const SMB_NTSTATUS_TOO_MANY_LUIDS_REQUESTED: u32 = 0xc0000074; -pub const SMB_NTSTATUS_LUIDS_EXHAUSTED: u32 = 0xc0000075; -pub const SMB_NTSTATUS_INVALID_SUB_AUTHORITY: u32 = 0xc0000076; -pub const SMB_NTSTATUS_INVALID_ACL: u32 = 0xc0000077; -pub const SMB_NTSTATUS_INVALID_SID: u32 = 0xc0000078; -pub const SMB_NTSTATUS_INVALID_SECURITY_DESCR: u32 = 0xc0000079; -pub const SMB_NTSTATUS_PROCEDURE_NOT_FOUND: u32 = 0xc000007a; -pub const SMB_NTSTATUS_INVALID_IMAGE_FORMAT: u32 = 0xc000007b; -pub const SMB_NTSTATUS_NO_TOKEN: u32 = 0xc000007c; -pub const SMB_NTSTATUS_BAD_INHERITANCE_ACL: u32 = 0xc000007d; -pub const SMB_NTSTATUS_RANGE_NOT_LOCKED: u32 = 0xc000007e; -pub const SMB_NTSTATUS_DISK_FULL: u32 = 0xc000007f; -pub const SMB_NTSTATUS_SERVER_DISABLED: u32 = 0xc0000080; -pub const SMB_NTSTATUS_SERVER_NOT_DISABLED: u32 = 0xc0000081; -pub const SMB_NTSTATUS_TOO_MANY_GUIDS_REQUESTED: u32 = 0xc0000082; -pub const SMB_NTSTATUS_GUIDS_EXHAUSTED: u32 = 0xc0000083; -pub const SMB_NTSTATUS_INVALID_ID_AUTHORITY: u32 = 0xc0000084; -pub const SMB_NTSTATUS_AGENTS_EXHAUSTED: u32 = 0xc0000085; -pub const SMB_NTSTATUS_INVALID_VOLUME_LABEL: u32 = 0xc0000086; -pub const SMB_NTSTATUS_SECTION_NOT_EXTENDED: u32 = 0xc0000087; -pub const SMB_NTSTATUS_NOT_MAPPED_DATA: u32 = 0xc0000088; -pub const SMB_NTSTATUS_RESOURCE_DATA_NOT_FOUND: u32 = 0xc0000089; -pub const SMB_NTSTATUS_RESOURCE_TYPE_NOT_FOUND: u32 = 0xc000008a; -pub const SMB_NTSTATUS_RESOURCE_NAME_NOT_FOUND: u32 = 0xc000008b; -pub const SMB_NTSTATUS_ARRAY_BOUNDS_EXCEEDED: u32 = 0xc000008c; -pub const SMB_NTSTATUS_FLOAT_DENORMAL_OPERAND: u32 = 0xc000008d; -pub const SMB_NTSTATUS_FLOAT_DIVIDE_BY_ZERO: u32 = 0xc000008e; -pub const SMB_NTSTATUS_FLOAT_INEXACT_RESULT: u32 = 0xc000008f; -pub const SMB_NTSTATUS_FLOAT_INVALID_OPERATION: u32 = 0xc0000090; -pub const SMB_NTSTATUS_FLOAT_OVERFLOW: u32 = 0xc0000091; -pub const SMB_NTSTATUS_FLOAT_STACK_CHECK: u32 = 0xc0000092; -pub const SMB_NTSTATUS_FLOAT_UNDERFLOW: u32 = 0xc0000093; -pub const SMB_NTSTATUS_INTEGER_DIVIDE_BY_ZERO: u32 = 0xc0000094; -pub const SMB_NTSTATUS_INTEGER_OVERFLOW: u32 = 0xc0000095; -pub const SMB_NTSTATUS_PRIVILEGED_INSTRUCTION: u32 = 0xc0000096; -pub const SMB_NTSTATUS_TOO_MANY_PAGING_FILES: u32 = 0xc0000097; -pub const SMB_NTSTATUS_FILE_INVALID: u32 = 0xc0000098; -pub const SMB_NTSTATUS_ALLOTTED_SPACE_EXCEEDED: u32 = 0xc0000099; -pub const SMB_NTSTATUS_INSUFFICIENT_RESOURCES: u32 = 0xc000009a; -pub const SMB_NTSTATUS_DFS_EXIT_PATH_FOUND: u32 = 0xc000009b; -pub const SMB_NTSTATUS_DEVICE_DATA_ERROR: u32 = 0xc000009c; -pub const SMB_NTSTATUS_DEVICE_NOT_CONNECTED: u32 = 0xc000009d; -pub const SMB_NTSTATUS_FREE_VM_NOT_AT_BASE: u32 = 0xc000009f; -pub const SMB_NTSTATUS_MEMORY_NOT_ALLOCATED: u32 = 0xc00000a0; -pub const SMB_NTSTATUS_WORKING_SET_QUOTA: u32 = 0xc00000a1; -pub const SMB_NTSTATUS_MEDIA_WRITE_PROTECTED: u32 = 0xc00000a2; -pub const SMB_NTSTATUS_DEVICE_NOT_READY: u32 = 0xc00000a3; -pub const SMB_NTSTATUS_INVALID_GROUP_ATTRIBUTES: u32 = 0xc00000a4; -pub const SMB_NTSTATUS_BAD_IMPERSONATION_LEVEL: u32 = 0xc00000a5; -pub const SMB_NTSTATUS_CANT_OPEN_ANONYMOUS: u32 = 0xc00000a6; -pub const SMB_NTSTATUS_BAD_VALIDATION_CLASS: u32 = 0xc00000a7; -pub const SMB_NTSTATUS_BAD_TOKEN_TYPE: u32 = 0xc00000a8; -pub const SMB_NTSTATUS_BAD_MASTER_BOOT_RECORD: u32 = 0xc00000a9; -pub const SMB_NTSTATUS_INSTRUCTION_MISALIGNMENT: u32 = 0xc00000aa; -pub const SMB_NTSTATUS_INSTANCE_NOT_AVAILABLE: u32 = 0xc00000ab; -pub const SMB_NTSTATUS_PIPE_NOT_AVAILABLE: u32 = 0xc00000ac; -pub const SMB_NTSTATUS_INVALID_PIPE_STATE: u32 = 0xc00000ad; -pub const SMB_NTSTATUS_PIPE_BUSY: u32 = 0xc00000ae; -pub const SMB_NTSTATUS_ILLEGAL_FUNCTION: u32 = 0xc00000af; -pub const SMB_NTSTATUS_PIPE_DISCONNECTED: u32 = 0xc00000b0; -pub const SMB_NTSTATUS_PIPE_CLOSING: u32 = 0xc00000b1; -pub const SMB_NTSTATUS_PIPE_CONNECTED: u32 = 0xc00000b2; -pub const SMB_NTSTATUS_PIPE_LISTENING: u32 = 0xc00000b3; -pub const SMB_NTSTATUS_INVALID_READ_MODE: u32 = 0xc00000b4; -pub const SMB_NTSTATUS_IO_TIMEOUT: u32 = 0xc00000b5; -pub const SMB_NTSTATUS_FILE_FORCED_CLOSED: u32 = 0xc00000b6; -pub const SMB_NTSTATUS_PROFILING_NOT_STARTED: u32 = 0xc00000b7; -pub const SMB_NTSTATUS_PROFILING_NOT_STOPPED: u32 = 0xc00000b8; -pub const SMB_NTSTATUS_COULD_NOT_INTERPRET: u32 = 0xc00000b9; -pub const SMB_NTSTATUS_FILE_IS_A_DIRECTORY: u32 = 0xc00000ba; -pub const SMB_NTSTATUS_NOT_SUPPORTED: u32 = 0xc00000bb; -pub const SMB_NTSTATUS_REMOTE_NOT_LISTENING: u32 = 0xc00000bc; -pub const SMB_NTSTATUS_DUPLICATE_NAME: u32 = 0xc00000bd; -pub const SMB_NTSTATUS_BAD_NETWORK_PATH: u32 = 0xc00000be; -pub const SMB_NTSTATUS_NETWORK_BUSY: u32 = 0xc00000bf; -pub const SMB_NTSTATUS_DEVICE_DOES_NOT_EXIST: u32 = 0xc00000c0; -pub const SMB_NTSTATUS_TOO_MANY_COMMANDS: u32 = 0xc00000c1; -pub const SMB_NTSTATUS_ADAPTER_HARDWARE_ERROR: u32 = 0xc00000c2; -pub const SMB_NTSTATUS_INVALID_NETWORK_RESPONSE: u32 = 0xc00000c3; -pub const SMB_NTSTATUS_UNEXPECTED_NETWORK_ERROR: u32 = 0xc00000c4; -pub const SMB_NTSTATUS_BAD_REMOTE_ADAPTER: u32 = 0xc00000c5; -pub const SMB_NTSTATUS_PRINT_QUEUE_FULL: u32 = 0xc00000c6; -pub const SMB_NTSTATUS_NO_SPOOL_SPACE: u32 = 0xc00000c7; -pub const SMB_NTSTATUS_PRINT_CANCELLED: u32 = 0xc00000c8; -pub const SMB_NTSTATUS_NETWORK_NAME_DELETED: u32 = 0xc00000c9; -pub const SMB_NTSTATUS_NETWORK_ACCESS_DENIED: u32 = 0xc00000ca; -pub const SMB_NTSTATUS_BAD_DEVICE_TYPE: u32 = 0xc00000cb; -pub const SMB_NTSTATUS_BAD_NETWORK_NAME: u32 = 0xc00000cc; -pub const SMB_NTSTATUS_TOO_MANY_NAMES: u32 = 0xc00000cd; -pub const SMB_NTSTATUS_TOO_MANY_SESSIONS: u32 = 0xc00000ce; -pub const SMB_NTSTATUS_SHARING_PAUSED: u32 = 0xc00000cf; -pub const SMB_NTSTATUS_REQUEST_NOT_ACCEPTED: u32 = 0xc00000d0; -pub const SMB_NTSTATUS_REDIRECTOR_PAUSED: u32 = 0xc00000d1; -pub const SMB_NTSTATUS_NET_WRITE_FAULT: u32 = 0xc00000d2; -pub const SMB_NTSTATUS_PROFILING_AT_LIMIT: u32 = 0xc00000d3; -pub const SMB_NTSTATUS_NOT_SAME_DEVICE: u32 = 0xc00000d4; -pub const SMB_NTSTATUS_FILE_RENAMED: u32 = 0xc00000d5; -pub const SMB_NTSTATUS_VIRTUAL_CIRCUIT_CLOSED: u32 = 0xc00000d6; -pub const SMB_NTSTATUS_NO_SECURITY_ON_OBJECT: u32 = 0xc00000d7; -pub const SMB_NTSTATUS_CANT_WAIT: u32 = 0xc00000d8; -pub const SMB_NTSTATUS_PIPE_EMPTY: u32 = 0xc00000d9; -pub const SMB_NTSTATUS_CANT_ACCESS_DOMAIN_INFO: u32 = 0xc00000da; -pub const SMB_NTSTATUS_CANT_TERMINATE_SELF: u32 = 0xc00000db; -pub const SMB_NTSTATUS_INVALID_SERVER_STATE: u32 = 0xc00000dc; -pub const SMB_NTSTATUS_INVALID_DOMAIN_STATE: u32 = 0xc00000dd; -pub const SMB_NTSTATUS_INVALID_DOMAIN_ROLE: u32 = 0xc00000de; -pub const SMB_NTSTATUS_NO_SUCH_DOMAIN: u32 = 0xc00000df; -pub const SMB_NTSTATUS_DOMAIN_EXISTS: u32 = 0xc00000e0; -pub const SMB_NTSTATUS_DOMAIN_LIMIT_EXCEEDED: u32 = 0xc00000e1; -pub const SMB_NTSTATUS_OPLOCK_NOT_GRANTED: u32 = 0xc00000e2; -pub const SMB_NTSTATUS_INVALID_OPLOCK_PROTOCOL: u32 = 0xc00000e3; -pub const SMB_NTSTATUS_INTERNAL_DB_CORRUPTION: u32 = 0xc00000e4; -pub const SMB_NTSTATUS_INTERNAL_ERROR: u32 = 0xc00000e5; -pub const SMB_NTSTATUS_GENERIC_NOT_MAPPED: u32 = 0xc00000e6; -pub const SMB_NTSTATUS_BAD_DESCRIPTOR_FORMAT: u32 = 0xc00000e7; -pub const SMB_NTSTATUS_INVALID_USER_BUFFER: u32 = 0xc00000e8; -pub const SMB_NTSTATUS_UNEXPECTED_IO_ERROR: u32 = 0xc00000e9; -pub const SMB_NTSTATUS_UNEXPECTED_MM_CREATE_ERR: u32 = 0xc00000ea; -pub const SMB_NTSTATUS_UNEXPECTED_MM_MAP_ERROR: u32 = 0xc00000eb; -pub const SMB_NTSTATUS_UNEXPECTED_MM_EXTEND_ERR: u32 = 0xc00000ec; -pub const SMB_NTSTATUS_NOT_LOGON_PROCESS: u32 = 0xc00000ed; -pub const SMB_NTSTATUS_LOGON_SESSION_EXISTS: u32 = 0xc00000ee; -pub const SMB_NTSTATUS_INVALID_PARAMETER_1: u32 = 0xc00000ef; -pub const SMB_NTSTATUS_INVALID_PARAMETER_2: u32 = 0xc00000f0; -pub const SMB_NTSTATUS_INVALID_PARAMETER_3: u32 = 0xc00000f1; -pub const SMB_NTSTATUS_INVALID_PARAMETER_4: u32 = 0xc00000f2; -pub const SMB_NTSTATUS_INVALID_PARAMETER_5: u32 = 0xc00000f3; -pub const SMB_NTSTATUS_INVALID_PARAMETER_6: u32 = 0xc00000f4; -pub const SMB_NTSTATUS_INVALID_PARAMETER_7: u32 = 0xc00000f5; -pub const SMB_NTSTATUS_INVALID_PARAMETER_8: u32 = 0xc00000f6; -pub const SMB_NTSTATUS_INVALID_PARAMETER_9: u32 = 0xc00000f7; -pub const SMB_NTSTATUS_INVALID_PARAMETER_10: u32 = 0xc00000f8; -pub const SMB_NTSTATUS_INVALID_PARAMETER_11: u32 = 0xc00000f9; -pub const SMB_NTSTATUS_INVALID_PARAMETER_12: u32 = 0xc00000fa; -pub const SMB_NTSTATUS_REDIRECTOR_NOT_STARTED: u32 = 0xc00000fb; -pub const SMB_NTSTATUS_REDIRECTOR_STARTED: u32 = 0xc00000fc; -pub const SMB_NTSTATUS_STACK_OVERFLOW: u32 = 0xc00000fd; -pub const SMB_NTSTATUS_NO_SUCH_PACKAGE: u32 = 0xc00000fe; -pub const SMB_NTSTATUS_BAD_FUNCTION_TABLE: u32 = 0xc00000ff; -pub const SMB_NTSTATUS_VARIABLE_NOT_FOUND: u32 = 0xc0000100; -pub const SMB_NTSTATUS_DIRECTORY_NOT_EMPTY: u32 = 0xc0000101; -pub const SMB_NTSTATUS_FILE_CORRUPT_ERROR: u32 = 0xc0000102; -pub const SMB_NTSTATUS_NOT_A_DIRECTORY: u32 = 0xc0000103; -pub const SMB_NTSTATUS_BAD_LOGON_SESSION_STATE: u32 = 0xc0000104; -pub const SMB_NTSTATUS_LOGON_SESSION_COLLISION: u32 = 0xc0000105; -pub const SMB_NTSTATUS_NAME_TOO_LONG: u32 = 0xc0000106; -pub const SMB_NTSTATUS_FILES_OPEN: u32 = 0xc0000107; -pub const SMB_NTSTATUS_CONNECTION_IN_USE: u32 = 0xc0000108; -pub const SMB_NTSTATUS_MESSAGE_NOT_FOUND: u32 = 0xc0000109; -pub const SMB_NTSTATUS_PROCESS_IS_TERMINATING: u32 = 0xc000010a; -pub const SMB_NTSTATUS_INVALID_LOGON_TYPE: u32 = 0xc000010b; -pub const SMB_NTSTATUS_NO_GUID_TRANSLATION: u32 = 0xc000010c; -pub const SMB_NTSTATUS_CANNOT_IMPERSONATE: u32 = 0xc000010d; -pub const SMB_NTSTATUS_IMAGE_ALREADY_LOADED: u32 = 0xc000010e; -pub const SMB_NTSTATUS_NO_LDT: u32 = 0xc0000117; -pub const SMB_NTSTATUS_INVALID_LDT_SIZE: u32 = 0xc0000118; -pub const SMB_NTSTATUS_INVALID_LDT_OFFSET: u32 = 0xc0000119; -pub const SMB_NTSTATUS_INVALID_LDT_DESCRIPTOR: u32 = 0xc000011a; -pub const SMB_NTSTATUS_INVALID_IMAGE_NE_FORMAT: u32 = 0xc000011b; -pub const SMB_NTSTATUS_RXACT_INVALID_STATE: u32 = 0xc000011c; -pub const SMB_NTSTATUS_RXACT_COMMIT_FAILURE: u32 = 0xc000011d; -pub const SMB_NTSTATUS_MAPPED_FILE_SIZE_ZERO: u32 = 0xc000011e; -pub const SMB_NTSTATUS_TOO_MANY_OPENED_FILES: u32 = 0xc000011f; -pub const SMB_NTSTATUS_CANCELLED: u32 = 0xc0000120; -pub const SMB_NTSTATUS_CANNOT_DELETE: u32 = 0xc0000121; -pub const SMB_NTSTATUS_INVALID_COMPUTER_NAME: u32 = 0xc0000122; -pub const SMB_NTSTATUS_FILE_DELETED: u32 = 0xc0000123; -pub const SMB_NTSTATUS_SPECIAL_ACCOUNT: u32 = 0xc0000124; -pub const SMB_NTSTATUS_SPECIAL_GROUP: u32 = 0xc0000125; -pub const SMB_NTSTATUS_SPECIAL_USER: u32 = 0xc0000126; -pub const SMB_NTSTATUS_MEMBERS_PRIMARY_GROUP: u32 = 0xc0000127; -pub const SMB_NTSTATUS_FILE_CLOSED: u32 = 0xc0000128; -pub const SMB_NTSTATUS_TOO_MANY_THREADS: u32 = 0xc0000129; -pub const SMB_NTSTATUS_THREAD_NOT_IN_PROCESS: u32 = 0xc000012a; -pub const SMB_NTSTATUS_TOKEN_ALREADY_IN_USE: u32 = 0xc000012b; -pub const SMB_NTSTATUS_PAGEFILE_QUOTA_EXCEEDED: u32 = 0xc000012c; -pub const SMB_NTSTATUS_COMMITMENT_LIMIT: u32 = 0xc000012d; -pub const SMB_NTSTATUS_INVALID_IMAGE_LE_FORMAT: u32 = 0xc000012e; -pub const SMB_NTSTATUS_INVALID_IMAGE_NOT_MZ: u32 = 0xc000012f; -pub const SMB_NTSTATUS_INVALID_IMAGE_PROTECT: u32 = 0xc0000130; -pub const SMB_NTSTATUS_INVALID_IMAGE_WIN_16: u32 = 0xc0000131; -pub const SMB_NTSTATUS_LOGON_SERVER_CONFLICT: u32 = 0xc0000132; -pub const SMB_NTSTATUS_TIME_DIFFERENCE_AT_DC: u32 = 0xc0000133; -pub const SMB_NTSTATUS_SYNCHRONIZATION_REQUIRED: u32 = 0xc0000134; -pub const SMB_NTSTATUS_DLL_NOT_FOUND: u32 = 0xc0000135; -pub const SMB_NTSTATUS_OPEN_FAILED: u32 = 0xc0000136; -pub const SMB_NTSTATUS_IO_PRIVILEGE_FAILED: u32 = 0xc0000137; -pub const SMB_NTSTATUS_ORDINAL_NOT_FOUND: u32 = 0xc0000138; -pub const SMB_NTSTATUS_ENTRYPOINT_NOT_FOUND: u32 = 0xc0000139; -pub const SMB_NTSTATUS_CONTROL_C_EXIT: u32 = 0xc000013a; -pub const SMB_NTSTATUS_LOCAL_DISCONNECT: u32 = 0xc000013b; -pub const SMB_NTSTATUS_REMOTE_DISCONNECT: u32 = 0xc000013c; -pub const SMB_NTSTATUS_REMOTE_RESOURCES: u32 = 0xc000013d; -pub const SMB_NTSTATUS_LINK_FAILED: u32 = 0xc000013e; -pub const SMB_NTSTATUS_LINK_TIMEOUT: u32 = 0xc000013f; -pub const SMB_NTSTATUS_INVALID_CONNECTION: u32 = 0xc0000140; -pub const SMB_NTSTATUS_INVALID_ADDRESS: u32 = 0xc0000141; -pub const SMB_NTSTATUS_DLL_INIT_FAILED: u32 = 0xc0000142; -pub const SMB_NTSTATUS_MISSING_SYSTEMFILE: u32 = 0xc0000143; -pub const SMB_NTSTATUS_UNHANDLED_EXCEPTION: u32 = 0xc0000144; -pub const SMB_NTSTATUS_APP_INIT_FAILURE: u32 = 0xc0000145; -pub const SMB_NTSTATUS_PAGEFILE_CREATE_FAILED: u32 = 0xc0000146; -pub const SMB_NTSTATUS_NO_PAGEFILE: u32 = 0xc0000147; -pub const SMB_NTSTATUS_INVALID_LEVEL: u32 = 0xc0000148; -pub const SMB_NTSTATUS_WRONG_PASSWORD_CORE: u32 = 0xc0000149; -pub const SMB_NTSTATUS_ILLEGAL_FLOAT_CONTEXT: u32 = 0xc000014a; -pub const SMB_NTSTATUS_PIPE_BROKEN: u32 = 0xc000014b; -pub const SMB_NTSTATUS_REGISTRY_CORRUPT: u32 = 0xc000014c; -pub const SMB_NTSTATUS_REGISTRY_IO_FAILED: u32 = 0xc000014d; -pub const SMB_NTSTATUS_NO_EVENT_PAIR: u32 = 0xc000014e; -pub const SMB_NTSTATUS_UNRECOGNIZED_VOLUME: u32 = 0xc000014f; -pub const SMB_NTSTATUS_SERIAL_NO_DEVICE_INITED: u32 = 0xc0000150; -pub const SMB_NTSTATUS_NO_SUCH_ALIAS: u32 = 0xc0000151; -pub const SMB_NTSTATUS_MEMBER_NOT_IN_ALIAS: u32 = 0xc0000152; -pub const SMB_NTSTATUS_MEMBER_IN_ALIAS: u32 = 0xc0000153; -pub const SMB_NTSTATUS_ALIAS_EXISTS: u32 = 0xc0000154; -pub const SMB_NTSTATUS_LOGON_NOT_GRANTED: u32 = 0xc0000155; -pub const SMB_NTSTATUS_TOO_MANY_SECRETS: u32 = 0xc0000156; -pub const SMB_NTSTATUS_SECRET_TOO_LONG: u32 = 0xc0000157; -pub const SMB_NTSTATUS_INTERNAL_DB_ERROR: u32 = 0xc0000158; -pub const SMB_NTSTATUS_FULLSCREEN_MODE: u32 = 0xc0000159; -pub const SMB_NTSTATUS_TOO_MANY_CONTEXT_IDS: u32 = 0xc000015a; -pub const SMB_NTSTATUS_LOGON_TYPE_NOT_GRANTED: u32 = 0xc000015b; -pub const SMB_NTSTATUS_NOT_REGISTRY_FILE: u32 = 0xc000015c; -pub const SMB_NTSTATUS_NT_CROSS_ENCRYPTION_REQUIRED: u32 = 0xc000015d; -pub const SMB_NTSTATUS_DOMAIN_CTRLR_CONFIG_ERROR: u32 = 0xc000015e; -pub const SMB_NTSTATUS_FT_MISSING_MEMBER: u32 = 0xc000015f; -pub const SMB_NTSTATUS_ILL_FORMED_SERVICE_ENTRY: u32 = 0xc0000160; -pub const SMB_NTSTATUS_ILLEGAL_CHARACTER: u32 = 0xc0000161; -pub const SMB_NTSTATUS_UNMAPPABLE_CHARACTER: u32 = 0xc0000162; -pub const SMB_NTSTATUS_UNDEFINED_CHARACTER: u32 = 0xc0000163; -pub const SMB_NTSTATUS_FLOPPY_VOLUME: u32 = 0xc0000164; -pub const SMB_NTSTATUS_FLOPPY_ID_MARK_NOT_FOUND: u32 = 0xc0000165; -pub const SMB_NTSTATUS_FLOPPY_WRONG_CYLINDER: u32 = 0xc0000166; -pub const SMB_NTSTATUS_FLOPPY_UNKNOWN_ERROR: u32 = 0xc0000167; -pub const SMB_NTSTATUS_FLOPPY_BAD_REGISTERS: u32 = 0xc0000168; -pub const SMB_NTSTATUS_DISK_RECALIBRATE_FAILED: u32 = 0xc0000169; -pub const SMB_NTSTATUS_DISK_OPERATION_FAILED: u32 = 0xc000016a; -pub const SMB_NTSTATUS_DISK_RESET_FAILED: u32 = 0xc000016b; -pub const SMB_NTSTATUS_SHARED_IRQ_BUSY: u32 = 0xc000016c; -pub const SMB_NTSTATUS_FT_ORPHANING: u32 = 0xc000016d; -pub const SMB_NTSTATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT: u32 = 0xc000016e; -pub const SMB_NTSTATUS_PARTITION_FAILURE: u32 = 0xc0000172; -pub const SMB_NTSTATUS_INVALID_BLOCK_LENGTH: u32 = 0xc0000173; -pub const SMB_NTSTATUS_DEVICE_NOT_PARTITIONED: u32 = 0xc0000174; -pub const SMB_NTSTATUS_UNABLE_TO_LOCK_MEDIA: u32 = 0xc0000175; -pub const SMB_NTSTATUS_UNABLE_TO_UNLOAD_MEDIA: u32 = 0xc0000176; -pub const SMB_NTSTATUS_EOM_OVERFLOW: u32 = 0xc0000177; -pub const SMB_NTSTATUS_NO_MEDIA: u32 = 0xc0000178; -pub const SMB_NTSTATUS_NO_SUCH_MEMBER: u32 = 0xc000017a; -pub const SMB_NTSTATUS_INVALID_MEMBER: u32 = 0xc000017b; -pub const SMB_NTSTATUS_KEY_DELETED: u32 = 0xc000017c; -pub const SMB_NTSTATUS_NO_LOG_SPACE: u32 = 0xc000017d; -pub const SMB_NTSTATUS_TOO_MANY_SIDS: u32 = 0xc000017e; -pub const SMB_NTSTATUS_LM_CROSS_ENCRYPTION_REQUIRED: u32 = 0xc000017f; -pub const SMB_NTSTATUS_KEY_HAS_CHILDREN: u32 = 0xc0000180; -pub const SMB_NTSTATUS_CHILD_MUST_BE_VOLATILE: u32 = 0xc0000181; -pub const SMB_NTSTATUS_DEVICE_CONFIGURATION_ERROR: u32 = 0xc0000182; -pub const SMB_NTSTATUS_DRIVER_INTERNAL_ERROR: u32 = 0xc0000183; -pub const SMB_NTSTATUS_INVALID_DEVICE_STATE: u32 = 0xc0000184; -pub const SMB_NTSTATUS_IO_DEVICE_ERROR: u32 = 0xc0000185; -pub const SMB_NTSTATUS_DEVICE_PROTOCOL_ERROR: u32 = 0xc0000186; -pub const SMB_NTSTATUS_BACKUP_CONTROLLER: u32 = 0xc0000187; -pub const SMB_NTSTATUS_LOG_FILE_FULL: u32 = 0xc0000188; -pub const SMB_NTSTATUS_TOO_LATE: u32 = 0xc0000189; -pub const SMB_NTSTATUS_NO_TRUST_LSA_SECRET: u32 = 0xc000018a; -pub const SMB_NTSTATUS_NO_TRUST_SAM_ACCOUNT: u32 = 0xc000018b; -pub const SMB_NTSTATUS_TRUSTED_DOMAIN_FAILURE: u32 = 0xc000018c; -pub const SMB_NTSTATUS_TRUSTED_RELATIONSHIP_FAILURE: u32 = 0xc000018d; -pub const SMB_NTSTATUS_EVENTLOG_FILE_CORRUPT: u32 = 0xc000018e; -pub const SMB_NTSTATUS_EVENTLOG_CANT_START: u32 = 0xc000018f; -pub const SMB_NTSTATUS_TRUST_FAILURE: u32 = 0xc0000190; -pub const SMB_NTSTATUS_MUTANT_LIMIT_EXCEEDED: u32 = 0xc0000191; -pub const SMB_NTSTATUS_NETLOGON_NOT_STARTED: u32 = 0xc0000192; -pub const SMB_NTSTATUS_ACCOUNT_EXPIRED: u32 = 0xc0000193; -pub const SMB_NTSTATUS_POSSIBLE_DEADLOCK: u32 = 0xc0000194; -pub const SMB_NTSTATUS_NETWORK_CREDENTIAL_CONFLICT: u32 = 0xc0000195; -pub const SMB_NTSTATUS_REMOTE_SESSION_LIMIT: u32 = 0xc0000196; -pub const SMB_NTSTATUS_EVENTLOG_FILE_CHANGED: u32 = 0xc0000197; -pub const SMB_NTSTATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: u32 = 0xc0000198; -pub const SMB_NTSTATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT: u32 = 0xc0000199; -pub const SMB_NTSTATUS_NOLOGON_SERVER_TRUST_ACCOUNT: u32 = 0xc000019a; -pub const SMB_NTSTATUS_DOMAIN_TRUST_INCONSISTENT: u32 = 0xc000019b; -pub const SMB_NTSTATUS_FS_DRIVER_REQUIRED: u32 = 0xc000019c; -pub const SMB_NTSTATUS_IMAGE_ALREADY_LOADED_AS_DLL: u32 = 0xc000019d; -pub const SMB_NTSTATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: u32 = 0xc000019e; -pub const SMB_NTSTATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: u32 = 0xc000019f; -pub const SMB_NTSTATUS_SECURITY_STREAM_IS_INCONSISTENT: u32 = 0xc00001a0; -pub const SMB_NTSTATUS_INVALID_LOCK_RANGE: u32 = 0xc00001a1; -pub const SMB_NTSTATUS_INVALID_ACE_CONDITION: u32 = 0xc00001a2; -pub const SMB_NTSTATUS_IMAGE_SUBSYSTEM_NOT_PRESENT: u32 = 0xc00001a3; -pub const SMB_NTSTATUS_NOTIFICATION_GUID_ALREADY_DEFINED: u32 = 0xc00001a4; -pub const SMB_NTSTATUS_NETWORK_OPEN_RESTRICTION: u32 = 0xc0000201; -pub const SMB_NTSTATUS_NO_USER_SESSION_KEY: u32 = 0xc0000202; -pub const SMB_NTSTATUS_USER_SESSION_DELETED: u32 = 0xc0000203; -pub const SMB_NTSTATUS_RESOURCE_LANG_NOT_FOUND: u32 = 0xc0000204; -pub const SMB_NTSTATUS_INSUFF_SERVER_RESOURCES: u32 = 0xc0000205; -pub const SMB_NTSTATUS_INVALID_BUFFER_SIZE: u32 = 0xc0000206; -pub const SMB_NTSTATUS_INVALID_ADDRESS_COMPONENT: u32 = 0xc0000207; -pub const SMB_NTSTATUS_INVALID_ADDRESS_WILDCARD: u32 = 0xc0000208; -pub const SMB_NTSTATUS_TOO_MANY_ADDRESSES: u32 = 0xc0000209; -pub const SMB_NTSTATUS_ADDRESS_ALREADY_EXISTS: u32 = 0xc000020a; -pub const SMB_NTSTATUS_ADDRESS_CLOSED: u32 = 0xc000020b; -pub const SMB_NTSTATUS_CONNECTION_DISCONNECTED: u32 = 0xc000020c; -pub const SMB_NTSTATUS_CONNECTION_RESET: u32 = 0xc000020d; -pub const SMB_NTSTATUS_TOO_MANY_NODES: u32 = 0xc000020e; -pub const SMB_NTSTATUS_TRANSACTION_ABORTED: u32 = 0xc000020f; -pub const SMB_NTSTATUS_TRANSACTION_TIMED_OUT: u32 = 0xc0000210; -pub const SMB_NTSTATUS_TRANSACTION_NO_RELEASE: u32 = 0xc0000211; -pub const SMB_NTSTATUS_TRANSACTION_NO_MATCH: u32 = 0xc0000212; -pub const SMB_NTSTATUS_TRANSACTION_RESPONDED: u32 = 0xc0000213; -pub const SMB_NTSTATUS_TRANSACTION_INVALID_ID: u32 = 0xc0000214; -pub const SMB_NTSTATUS_TRANSACTION_INVALID_TYPE: u32 = 0xc0000215; -pub const SMB_NTSTATUS_NOT_SERVER_SESSION: u32 = 0xc0000216; -pub const SMB_NTSTATUS_NOT_CLIENT_SESSION: u32 = 0xc0000217; -pub const SMB_NTSTATUS_CANNOT_LOAD_REGISTRY_FILE: u32 = 0xc0000218; -pub const SMB_NTSTATUS_DEBUG_ATTACH_FAILED: u32 = 0xc0000219; -pub const SMB_NTSTATUS_SYSTEM_PROCESS_TERMINATED: u32 = 0xc000021a; -pub const SMB_NTSTATUS_DATA_NOT_ACCEPTED: u32 = 0xc000021b; -pub const SMB_NTSTATUS_NO_BROWSER_SERVERS_FOUND: u32 = 0xc000021c; -pub const SMB_NTSTATUS_VDM_HARD_ERROR: u32 = 0xc000021d; -pub const SMB_NTSTATUS_DRIVER_CANCEL_TIMEOUT: u32 = 0xc000021e; -pub const SMB_NTSTATUS_REPLY_MESSAGE_MISMATCH: u32 = 0xc000021f; -pub const SMB_NTSTATUS_MAPPED_ALIGNMENT: u32 = 0xc0000220; -pub const SMB_NTSTATUS_IMAGE_CHECKSUM_MISMATCH: u32 = 0xc0000221; -pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA: u32 = 0xc0000222; -pub const SMB_NTSTATUS_CLIENT_SERVER_PARAMETERS_INVALID: u32 = 0xc0000223; -pub const SMB_NTSTATUS_PASSWORD_MUST_CHANGE: u32 = 0xc0000224; -pub const SMB_NTSTATUS_NOT_FOUND: u32 = 0xc0000225; -pub const SMB_NTSTATUS_NOT_TINY_STREAM: u32 = 0xc0000226; -pub const SMB_NTSTATUS_RECOVERY_FAILURE: u32 = 0xc0000227; -pub const SMB_NTSTATUS_STACK_OVERFLOW_READ: u32 = 0xc0000228; -pub const SMB_NTSTATUS_FAIL_CHECK: u32 = 0xc0000229; -pub const SMB_NTSTATUS_DUPLICATE_OBJECTID: u32 = 0xc000022a; -pub const SMB_NTSTATUS_OBJECTID_EXISTS: u32 = 0xc000022b; -pub const SMB_NTSTATUS_CONVERT_TO_LARGE: u32 = 0xc000022c; -pub const SMB_NTSTATUS_RETRY: u32 = 0xc000022d; -pub const SMB_NTSTATUS_FOUND_OUT_OF_SCOPE: u32 = 0xc000022e; -pub const SMB_NTSTATUS_ALLOCATE_BUCKET: u32 = 0xc000022f; -pub const SMB_NTSTATUS_PROPSET_NOT_FOUND: u32 = 0xc0000230; -pub const SMB_NTSTATUS_MARSHALL_OVERFLOW: u32 = 0xc0000231; -pub const SMB_NTSTATUS_INVALID_VARIANT: u32 = 0xc0000232; -pub const SMB_NTSTATUS_DOMAIN_CONTROLLER_NOT_FOUND: u32 = 0xc0000233; -pub const SMB_NTSTATUS_ACCOUNT_LOCKED_OUT: u32 = 0xc0000234; -pub const SMB_NTSTATUS_HANDLE_NOT_CLOSABLE: u32 = 0xc0000235; -pub const SMB_NTSTATUS_CONNECTION_REFUSED: u32 = 0xc0000236; -pub const SMB_NTSTATUS_GRACEFUL_DISCONNECT: u32 = 0xc0000237; -pub const SMB_NTSTATUS_ADDRESS_ALREADY_ASSOCIATED: u32 = 0xc0000238; -pub const SMB_NTSTATUS_ADDRESS_NOT_ASSOCIATED: u32 = 0xc0000239; -pub const SMB_NTSTATUS_CONNECTION_INVALID: u32 = 0xc000023a; -pub const SMB_NTSTATUS_CONNECTION_ACTIVE: u32 = 0xc000023b; -pub const SMB_NTSTATUS_NETWORK_UNREACHABLE: u32 = 0xc000023c; -pub const SMB_NTSTATUS_HOST_UNREACHABLE: u32 = 0xc000023d; -pub const SMB_NTSTATUS_PROTOCOL_UNREACHABLE: u32 = 0xc000023e; -pub const SMB_NTSTATUS_PORT_UNREACHABLE: u32 = 0xc000023f; -pub const SMB_NTSTATUS_REQUEST_ABORTED: u32 = 0xc0000240; -pub const SMB_NTSTATUS_CONNECTION_ABORTED: u32 = 0xc0000241; -pub const SMB_NTSTATUS_BAD_COMPRESSION_BUFFER: u32 = 0xc0000242; -pub const SMB_NTSTATUS_USER_MAPPED_FILE: u32 = 0xc0000243; -pub const SMB_NTSTATUS_AUDIT_FAILED: u32 = 0xc0000244; -pub const SMB_NTSTATUS_TIMER_RESOLUTION_NOT_SET: u32 = 0xc0000245; -pub const SMB_NTSTATUS_CONNECTION_COUNT_LIMIT: u32 = 0xc0000246; -pub const SMB_NTSTATUS_LOGIN_TIME_RESTRICTION: u32 = 0xc0000247; -pub const SMB_NTSTATUS_LOGIN_WKSTA_RESTRICTION: u32 = 0xc0000248; -pub const SMB_NTSTATUS_IMAGE_MP_UP_MISMATCH: u32 = 0xc0000249; -pub const SMB_NTSTATUS_INSUFFICIENT_LOGON_INFO: u32 = 0xc0000250; -pub const SMB_NTSTATUS_BAD_DLL_ENTRYPOINT: u32 = 0xc0000251; -pub const SMB_NTSTATUS_BAD_SERVICE_ENTRYPOINT: u32 = 0xc0000252; -pub const SMB_NTSTATUS_LPC_REPLY_LOST: u32 = 0xc0000253; -pub const SMB_NTSTATUS_IP_ADDRESS_CONFLICT1: u32 = 0xc0000254; -pub const SMB_NTSTATUS_IP_ADDRESS_CONFLICT2: u32 = 0xc0000255; -pub const SMB_NTSTATUS_REGISTRY_QUOTA_LIMIT: u32 = 0xc0000256; -pub const SMB_NTSTATUS_PATH_NOT_COVERED: u32 = 0xc0000257; -pub const SMB_NTSTATUS_NO_CALLBACK_ACTIVE: u32 = 0xc0000258; -pub const SMB_NTSTATUS_LICENSE_QUOTA_EXCEEDED: u32 = 0xc0000259; -pub const SMB_NTSTATUS_PWD_TOO_SHORT: u32 = 0xc000025a; -pub const SMB_NTSTATUS_PWD_TOO_RECENT: u32 = 0xc000025b; -pub const SMB_NTSTATUS_PWD_HISTORY_CONFLICT: u32 = 0xc000025c; -pub const SMB_NTSTATUS_PLUGPLAY_NO_DEVICE: u32 = 0xc000025e; -pub const SMB_NTSTATUS_UNSUPPORTED_COMPRESSION: u32 = 0xc000025f; -pub const SMB_NTSTATUS_INVALID_HW_PROFILE: u32 = 0xc0000260; -pub const SMB_NTSTATUS_INVALID_PLUGPLAY_DEVICE_PATH: u32 = 0xc0000261; -pub const SMB_NTSTATUS_DRIVER_ORDINAL_NOT_FOUND: u32 = 0xc0000262; -pub const SMB_NTSTATUS_DRIVER_ENTRYPOINT_NOT_FOUND: u32 = 0xc0000263; -pub const SMB_NTSTATUS_RESOURCE_NOT_OWNED: u32 = 0xc0000264; -pub const SMB_NTSTATUS_TOO_MANY_LINKS: u32 = 0xc0000265; -pub const SMB_NTSTATUS_QUOTA_LIST_INCONSISTENT: u32 = 0xc0000266; -pub const SMB_NTSTATUS_FILE_IS_OFFLINE: u32 = 0xc0000267; -pub const SMB_NTSTATUS_EVALUATION_EXPIRATION: u32 = 0xc0000268; -pub const SMB_NTSTATUS_ILLEGAL_DLL_RELOCATION: u32 = 0xc0000269; -pub const SMB_NTSTATUS_LICENSE_VIOLATION: u32 = 0xc000026a; -pub const SMB_NTSTATUS_DLL_INIT_FAILED_LOGOFF: u32 = 0xc000026b; -pub const SMB_NTSTATUS_DRIVER_UNABLE_TO_LOAD: u32 = 0xc000026c; -pub const SMB_NTSTATUS_DFS_UNAVAILABLE: u32 = 0xc000026d; -pub const SMB_NTSTATUS_VOLUME_DISMOUNTED: u32 = 0xc000026e; -pub const SMB_NTSTATUS_WX86_INTERNAL_ERROR: u32 = 0xc000026f; -pub const SMB_NTSTATUS_WX86_FLOAT_STACK_CHECK: u32 = 0xc0000270; -pub const SMB_NTSTATUS_VALIDATE_CONTINUE: u32 = 0xc0000271; -pub const SMB_NTSTATUS_NO_MATCH: u32 = 0xc0000272; -pub const SMB_NTSTATUS_NO_MORE_MATCHES: u32 = 0xc0000273; -pub const SMB_NTSTATUS_NOT_A_REPARSE_POINT: u32 = 0xc0000275; -pub const SMB_NTSTATUS_IO_REPARSE_TAG_INVALID: u32 = 0xc0000276; -pub const SMB_NTSTATUS_IO_REPARSE_TAG_MISMATCH: u32 = 0xc0000277; -pub const SMB_NTSTATUS_IO_REPARSE_DATA_INVALID: u32 = 0xc0000278; -pub const SMB_NTSTATUS_IO_REPARSE_TAG_NOT_HANDLED: u32 = 0xc0000279; -pub const SMB_NTSTATUS_REPARSE_POINT_NOT_RESOLVED: u32 = 0xc0000280; -pub const SMB_NTSTATUS_DIRECTORY_IS_A_REPARSE_POINT: u32 = 0xc0000281; -pub const SMB_NTSTATUS_RANGE_LIST_CONFLICT: u32 = 0xc0000282; -pub const SMB_NTSTATUS_SOURCE_ELEMENT_EMPTY: u32 = 0xc0000283; -pub const SMB_NTSTATUS_DESTINATION_ELEMENT_FULL: u32 = 0xc0000284; -pub const SMB_NTSTATUS_ILLEGAL_ELEMENT_ADDRESS: u32 = 0xc0000285; -pub const SMB_NTSTATUS_MAGAZINE_NOT_PRESENT: u32 = 0xc0000286; -pub const SMB_NTSTATUS_REINITIALIZATION_NEEDED: u32 = 0xc0000287; -pub const SMB_NTSTATUS_ENCRYPTION_FAILED: u32 = 0xc000028a; -pub const SMB_NTSTATUS_DECRYPTION_FAILED: u32 = 0xc000028b; -pub const SMB_NTSTATUS_RANGE_NOT_FOUND: u32 = 0xc000028c; -pub const SMB_NTSTATUS_NO_RECOVERY_POLICY: u32 = 0xc000028d; -pub const SMB_NTSTATUS_NO_EFS: u32 = 0xc000028e; -pub const SMB_NTSTATUS_WRONG_EFS: u32 = 0xc000028f; -pub const SMB_NTSTATUS_NO_USER_KEYS: u32 = 0xc0000290; -pub const SMB_NTSTATUS_FILE_NOT_ENCRYPTED: u32 = 0xc0000291; -pub const SMB_NTSTATUS_NOT_EXPORT_FORMAT: u32 = 0xc0000292; -pub const SMB_NTSTATUS_FILE_ENCRYPTED: u32 = 0xc0000293; -pub const SMB_NTSTATUS_WMI_GUID_NOT_FOUND: u32 = 0xc0000295; -pub const SMB_NTSTATUS_WMI_INSTANCE_NOT_FOUND: u32 = 0xc0000296; -pub const SMB_NTSTATUS_WMI_ITEMID_NOT_FOUND: u32 = 0xc0000297; -pub const SMB_NTSTATUS_WMI_TRY_AGAIN: u32 = 0xc0000298; -pub const SMB_NTSTATUS_SHARED_POLICY: u32 = 0xc0000299; -pub const SMB_NTSTATUS_POLICY_OBJECT_NOT_FOUND: u32 = 0xc000029a; -pub const SMB_NTSTATUS_POLICY_ONLY_IN_DS: u32 = 0xc000029b; -pub const SMB_NTSTATUS_VOLUME_NOT_UPGRADED: u32 = 0xc000029c; -pub const SMB_NTSTATUS_REMOTE_STORAGE_NOT_ACTIVE: u32 = 0xc000029d; -pub const SMB_NTSTATUS_REMOTE_STORAGE_MEDIA_ERROR: u32 = 0xc000029e; -pub const SMB_NTSTATUS_NO_TRACKING_SERVICE: u32 = 0xc000029f; -pub const SMB_NTSTATUS_SERVER_SID_MISMATCH: u32 = 0xc00002a0; -pub const SMB_NTSTATUS_DS_NO_ATTRIBUTE_OR_VALUE: u32 = 0xc00002a1; -pub const SMB_NTSTATUS_DS_INVALID_ATTRIBUTE_SYNTAX: u32 = 0xc00002a2; -pub const SMB_NTSTATUS_DS_ATTRIBUTE_TYPE_UNDEFINED: u32 = 0xc00002a3; -pub const SMB_NTSTATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS: u32 = 0xc00002a4; -pub const SMB_NTSTATUS_DS_BUSY: u32 = 0xc00002a5; -pub const SMB_NTSTATUS_DS_UNAVAILABLE: u32 = 0xc00002a6; -pub const SMB_NTSTATUS_DS_NO_RIDS_ALLOCATED: u32 = 0xc00002a7; -pub const SMB_NTSTATUS_DS_NO_MORE_RIDS: u32 = 0xc00002a8; -pub const SMB_NTSTATUS_DS_INCORRECT_ROLE_OWNER: u32 = 0xc00002a9; -pub const SMB_NTSTATUS_DS_RIDMGR_INIT_ERROR: u32 = 0xc00002aa; -pub const SMB_NTSTATUS_DS_OBJ_CLASS_VIOLATION: u32 = 0xc00002ab; -pub const SMB_NTSTATUS_DS_CANT_ON_NON_LEAF: u32 = 0xc00002ac; -pub const SMB_NTSTATUS_DS_CANT_ON_RDN: u32 = 0xc00002ad; -pub const SMB_NTSTATUS_DS_CANT_MOD_OBJ_CLASS: u32 = 0xc00002ae; -pub const SMB_NTSTATUS_DS_CROSS_DOM_MOVE_FAILED: u32 = 0xc00002af; -pub const SMB_NTSTATUS_DS_GC_NOT_AVAILABLE: u32 = 0xc00002b0; -pub const SMB_NTSTATUS_DIRECTORY_SERVICE_REQUIRED: u32 = 0xc00002b1; -pub const SMB_NTSTATUS_REPARSE_ATTRIBUTE_CONFLICT: u32 = 0xc00002b2; -pub const SMB_NTSTATUS_CANT_ENABLE_DENY_ONLY: u32 = 0xc00002b3; -pub const SMB_NTSTATUS_FLOAT_MULTIPLE_FAULTS: u32 = 0xc00002b4; -pub const SMB_NTSTATUS_FLOAT_MULTIPLE_TRAPS: u32 = 0xc00002b5; -pub const SMB_NTSTATUS_DEVICE_REMOVED: u32 = 0xc00002b6; -pub const SMB_NTSTATUS_JOURNAL_DELETE_IN_PROGRESS: u32 = 0xc00002b7; -pub const SMB_NTSTATUS_JOURNAL_NOT_ACTIVE: u32 = 0xc00002b8; -pub const SMB_NTSTATUS_NOINTERFACE: u32 = 0xc00002b9; -pub const SMB_NTSTATUS_DS_ADMIN_LIMIT_EXCEEDED: u32 = 0xc00002c1; -pub const SMB_NTSTATUS_DRIVER_FAILED_SLEEP: u32 = 0xc00002c2; -pub const SMB_NTSTATUS_MUTUAL_AUTHENTICATION_FAILED: u32 = 0xc00002c3; -pub const SMB_NTSTATUS_CORRUPT_SYSTEM_FILE: u32 = 0xc00002c4; -pub const SMB_NTSTATUS_DATATYPE_MISALIGNMENT_ERROR: u32 = 0xc00002c5; -pub const SMB_NTSTATUS_WMI_READ_ONLY: u32 = 0xc00002c6; -pub const SMB_NTSTATUS_WMI_SET_FAILURE: u32 = 0xc00002c7; -pub const SMB_NTSTATUS_COMMITMENT_MINIMUM: u32 = 0xc00002c8; -pub const SMB_NTSTATUS_REG_NAT_CONSUMPTION: u32 = 0xc00002c9; -pub const SMB_NTSTATUS_TRANSPORT_FULL: u32 = 0xc00002ca; -pub const SMB_NTSTATUS_DS_SAM_INIT_FAILURE: u32 = 0xc00002cb; -pub const SMB_NTSTATUS_ONLY_IF_CONNECTED: u32 = 0xc00002cc; -pub const SMB_NTSTATUS_DS_SENSITIVE_GROUP_VIOLATION: u32 = 0xc00002cd; -pub const SMB_NTSTATUS_PNP_RESTART_ENUMERATION: u32 = 0xc00002ce; -pub const SMB_NTSTATUS_JOURNAL_ENTRY_DELETED: u32 = 0xc00002cf; -pub const SMB_NTSTATUS_DS_CANT_MOD_PRIMARYGROUPID: u32 = 0xc00002d0; -pub const SMB_NTSTATUS_SYSTEM_IMAGE_BAD_SIGNATURE: u32 = 0xc00002d1; -pub const SMB_NTSTATUS_PNP_REBOOT_REQUIRED: u32 = 0xc00002d2; -pub const SMB_NTSTATUS_POWER_STATE_INVALID: u32 = 0xc00002d3; -pub const SMB_NTSTATUS_DS_INVALID_GROUP_TYPE: u32 = 0xc00002d4; -pub const SMB_NTSTATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: u32 = 0xc00002d5; -pub const SMB_NTSTATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: u32 = 0xc00002d6; -pub const SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: u32 = 0xc00002d7; -pub const SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: u32 = 0xc00002d8; -pub const SMB_NTSTATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: u32 = 0xc00002d9; -pub const SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: u32 = 0xc00002da; -pub const SMB_NTSTATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: u32 = 0xc00002db; -pub const SMB_NTSTATUS_DS_HAVE_PRIMARY_MEMBERS: u32 = 0xc00002dc; -pub const SMB_NTSTATUS_WMI_NOT_SUPPORTED: u32 = 0xc00002dd; -pub const SMB_NTSTATUS_INSUFFICIENT_POWER: u32 = 0xc00002de; -pub const SMB_NTSTATUS_SAM_NEED_BOOTKEY_PASSWORD: u32 = 0xc00002df; -pub const SMB_NTSTATUS_SAM_NEED_BOOTKEY_FLOPPY: u32 = 0xc00002e0; -pub const SMB_NTSTATUS_DS_CANT_START: u32 = 0xc00002e1; -pub const SMB_NTSTATUS_DS_INIT_FAILURE: u32 = 0xc00002e2; -pub const SMB_NTSTATUS_SAM_INIT_FAILURE: u32 = 0xc00002e3; -pub const SMB_NTSTATUS_DS_GC_REQUIRED: u32 = 0xc00002e4; -pub const SMB_NTSTATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: u32 = 0xc00002e5; -pub const SMB_NTSTATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS: u32 = 0xc00002e6; -pub const SMB_NTSTATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: u32 = 0xc00002e7; -pub const SMB_NTSTATUS_CURRENT_DOMAIN_NOT_ALLOWED: u32 = 0xc00002e9; -pub const SMB_NTSTATUS_CANNOT_MAKE: u32 = 0xc00002ea; -pub const SMB_NTSTATUS_SYSTEM_SHUTDOWN: u32 = 0xc00002eb; -pub const SMB_NTSTATUS_DS_INIT_FAILURE_CONSOLE: u32 = 0xc00002ec; -pub const SMB_NTSTATUS_DS_SAM_INIT_FAILURE_CONSOLE: u32 = 0xc00002ed; -pub const SMB_NTSTATUS_UNFINISHED_CONTEXT_DELETED: u32 = 0xc00002ee; -pub const SMB_NTSTATUS_NO_TGT_REPLY: u32 = 0xc00002ef; -pub const SMB_NTSTATUS_OBJECTID_NOT_FOUND: u32 = 0xc00002f0; -pub const SMB_NTSTATUS_NO_IP_ADDRESSES: u32 = 0xc00002f1; -pub const SMB_NTSTATUS_WRONG_CREDENTIAL_HANDLE: u32 = 0xc00002f2; -pub const SMB_NTSTATUS_CRYPTO_SYSTEM_INVALID: u32 = 0xc00002f3; -pub const SMB_NTSTATUS_MAX_REFERRALS_EXCEEDED: u32 = 0xc00002f4; -pub const SMB_NTSTATUS_MUST_BE_KDC: u32 = 0xc00002f5; -pub const SMB_NTSTATUS_STRONG_CRYPTO_NOT_SUPPORTED: u32 = 0xc00002f6; -pub const SMB_NTSTATUS_TOO_MANY_PRINCIPALS: u32 = 0xc00002f7; -pub const SMB_NTSTATUS_NO_PA_DATA: u32 = 0xc00002f8; -pub const SMB_NTSTATUS_PKINIT_NAME_MISMATCH: u32 = 0xc00002f9; -pub const SMB_NTSTATUS_SMARTCARD_LOGON_REQUIRED: u32 = 0xc00002fa; -pub const SMB_NTSTATUS_KDC_INVALID_REQUEST: u32 = 0xc00002fb; -pub const SMB_NTSTATUS_KDC_UNABLE_TO_REFER: u32 = 0xc00002fc; -pub const SMB_NTSTATUS_KDC_UNKNOWN_ETYPE: u32 = 0xc00002fd; -pub const SMB_NTSTATUS_SHUTDOWN_IN_PROGRESS: u32 = 0xc00002fe; -pub const SMB_NTSTATUS_SERVER_SHUTDOWN_IN_PROGRESS: u32 = 0xc00002ff; -pub const SMB_NTSTATUS_NOT_SUPPORTED_ON_SBS: u32 = 0xc0000300; -pub const SMB_NTSTATUS_WMI_GUID_DISCONNECTED: u32 = 0xc0000301; -pub const SMB_NTSTATUS_WMI_ALREADY_DISABLED: u32 = 0xc0000302; -pub const SMB_NTSTATUS_WMI_ALREADY_ENABLED: u32 = 0xc0000303; -pub const SMB_NTSTATUS_MFT_TOO_FRAGMENTED: u32 = 0xc0000304; -pub const SMB_NTSTATUS_COPY_PROTECTION_FAILURE: u32 = 0xc0000305; -pub const SMB_NTSTATUS_CSS_AUTHENTICATION_FAILURE: u32 = 0xc0000306; -pub const SMB_NTSTATUS_CSS_KEY_NOT_PRESENT: u32 = 0xc0000307; -pub const SMB_NTSTATUS_CSS_KEY_NOT_ESTABLISHED: u32 = 0xc0000308; -pub const SMB_NTSTATUS_CSS_SCRAMBLED_SECTOR: u32 = 0xc0000309; -pub const SMB_NTSTATUS_CSS_REGION_MISMATCH: u32 = 0xc000030a; -pub const SMB_NTSTATUS_CSS_RESETS_EXHAUSTED: u32 = 0xc000030b; -pub const SMB_NTSTATUS_PKINIT_FAILURE: u32 = 0xc0000320; -pub const SMB_NTSTATUS_SMARTCARD_SUBSYSTEM_FAILURE: u32 = 0xc0000321; -pub const SMB_NTSTATUS_NO_KERB_KEY: u32 = 0xc0000322; -pub const SMB_NTSTATUS_HOST_DOWN: u32 = 0xc0000350; -pub const SMB_NTSTATUS_UNSUPPORTED_PREAUTH: u32 = 0xc0000351; -pub const SMB_NTSTATUS_EFS_ALG_BLOB_TOO_BIG: u32 = 0xc0000352; -pub const SMB_NTSTATUS_PORT_NOT_SET: u32 = 0xc0000353; -pub const SMB_NTSTATUS_DEBUGGER_INACTIVE: u32 = 0xc0000354; -pub const SMB_NTSTATUS_DS_VERSION_CHECK_FAILURE: u32 = 0xc0000355; -pub const SMB_NTSTATUS_AUDITING_DISABLED: u32 = 0xc0000356; -pub const SMB_NTSTATUS_PRENT4_MACHINE_ACCOUNT: u32 = 0xc0000357; -pub const SMB_NTSTATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: u32 = 0xc0000358; -pub const SMB_NTSTATUS_INVALID_IMAGE_WIN_32: u32 = 0xc0000359; -pub const SMB_NTSTATUS_INVALID_IMAGE_WIN_64: u32 = 0xc000035a; -pub const SMB_NTSTATUS_BAD_BINDINGS: u32 = 0xc000035b; -pub const SMB_NTSTATUS_NETWORK_SESSION_EXPIRED: u32 = 0xc000035c; -pub const SMB_NTSTATUS_APPHELP_BLOCK: u32 = 0xc000035d; -pub const SMB_NTSTATUS_ALL_SIDS_FILTERED: u32 = 0xc000035e; -pub const SMB_NTSTATUS_NOT_SAFE_MODE_DRIVER: u32 = 0xc000035f; -pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT: u32 = 0xc0000361; -pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PATH: u32 = 0xc0000362; -pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER: u32 = 0xc0000363; -pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_OTHER: u32 = 0xc0000364; -pub const SMB_NTSTATUS_FAILED_DRIVER_ENTRY: u32 = 0xc0000365; -pub const SMB_NTSTATUS_DEVICE_ENUMERATION_ERROR: u32 = 0xc0000366; -pub const SMB_NTSTATUS_MOUNT_POINT_NOT_RESOLVED: u32 = 0xc0000368; -pub const SMB_NTSTATUS_INVALID_DEVICE_OBJECT_PARAMETER: u32 = 0xc0000369; -pub const SMB_NTSTATUS_MCA_OCCURED: u32 = 0xc000036a; -pub const SMB_NTSTATUS_DRIVER_BLOCKED_CRITICAL: u32 = 0xc000036b; -pub const SMB_NTSTATUS_DRIVER_BLOCKED: u32 = 0xc000036c; -pub const SMB_NTSTATUS_DRIVER_DATABASE_ERROR: u32 = 0xc000036d; -pub const SMB_NTSTATUS_SYSTEM_HIVE_TOO_LARGE: u32 = 0xc000036e; -pub const SMB_NTSTATUS_INVALID_IMPORT_OF_NON_DLL: u32 = 0xc000036f; -pub const SMB_NTSTATUS_NO_SECRETS: u32 = 0xc0000371; -pub const SMB_NTSTATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: u32 = 0xc0000372; -pub const SMB_NTSTATUS_FAILED_STACK_SWITCH: u32 = 0xc0000373; -pub const SMB_NTSTATUS_HEAP_CORRUPTION: u32 = 0xc0000374; -pub const SMB_NTSTATUS_SMARTCARD_WRONG_PIN: u32 = 0xc0000380; -pub const SMB_NTSTATUS_SMARTCARD_CARD_BLOCKED: u32 = 0xc0000381; -pub const SMB_NTSTATUS_SMARTCARD_CARD_NOT_AUTHENTICATED: u32 = 0xc0000382; -pub const SMB_NTSTATUS_SMARTCARD_NO_CARD: u32 = 0xc0000383; -pub const SMB_NTSTATUS_SMARTCARD_NO_KEY_CONTAINER: u32 = 0xc0000384; -pub const SMB_NTSTATUS_SMARTCARD_NO_CERTIFICATE: u32 = 0xc0000385; -pub const SMB_NTSTATUS_SMARTCARD_NO_KEYSET: u32 = 0xc0000386; -pub const SMB_NTSTATUS_SMARTCARD_IO_ERROR: u32 = 0xc0000387; -pub const SMB_NTSTATUS_DOWNGRADE_DETECTED: u32 = 0xc0000388; -pub const SMB_NTSTATUS_SMARTCARD_CERT_REVOKED: u32 = 0xc0000389; -pub const SMB_NTSTATUS_ISSUING_CA_UNTRUSTED: u32 = 0xc000038a; -pub const SMB_NTSTATUS_REVOCATION_OFFLINE_C: u32 = 0xc000038b; -pub const SMB_NTSTATUS_PKINIT_CLIENT_FAILURE: u32 = 0xc000038c; -pub const SMB_NTSTATUS_SMARTCARD_CERT_EXPIRED: u32 = 0xc000038d; -pub const SMB_NTSTATUS_DRIVER_FAILED_PRIOR_UNLOAD: u32 = 0xc000038e; -pub const SMB_NTSTATUS_SMARTCARD_SILENT_CONTEXT: u32 = 0xc000038f; -pub const SMB_NTSTATUS_PER_USER_TRUST_QUOTA_EXCEEDED: u32 = 0xc0000401; -pub const SMB_NTSTATUS_ALL_USER_TRUST_QUOTA_EXCEEDED: u32 = 0xc0000402; -pub const SMB_NTSTATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED: u32 = 0xc0000403; -pub const SMB_NTSTATUS_DS_NAME_NOT_UNIQUE: u32 = 0xc0000404; -pub const SMB_NTSTATUS_DS_DUPLICATE_ID_FOUND: u32 = 0xc0000405; -pub const SMB_NTSTATUS_DS_GROUP_CONVERSION_ERROR: u32 = 0xc0000406; -pub const SMB_NTSTATUS_VOLSNAP_PREPARE_HIBERNATE: u32 = 0xc0000407; -pub const SMB_NTSTATUS_USER2USER_REQUIRED: u32 = 0xc0000408; -pub const SMB_NTSTATUS_STACK_BUFFER_OVERRUN: u32 = 0xc0000409; -pub const SMB_NTSTATUS_NO_S4U_PROT_SUPPORT: u32 = 0xc000040a; -pub const SMB_NTSTATUS_CROSSREALM_DELEGATION_FAILURE: u32 = 0xc000040b; -pub const SMB_NTSTATUS_REVOCATION_OFFLINE_KDC: u32 = 0xc000040c; -pub const SMB_NTSTATUS_ISSUING_CA_UNTRUSTED_KDC: u32 = 0xc000040d; -pub const SMB_NTSTATUS_KDC_CERT_EXPIRED: u32 = 0xc000040e; -pub const SMB_NTSTATUS_KDC_CERT_REVOKED: u32 = 0xc000040f; -pub const SMB_NTSTATUS_PARAMETER_QUOTA_EXCEEDED: u32 = 0xc0000410; -pub const SMB_NTSTATUS_HIBERNATION_FAILURE: u32 = 0xc0000411; -pub const SMB_NTSTATUS_DELAY_LOAD_FAILED: u32 = 0xc0000412; -pub const SMB_NTSTATUS_AUTHENTICATION_FIREWALL_FAILED: u32 = 0xc0000413; -pub const SMB_NTSTATUS_VDM_DISALLOWED: u32 = 0xc0000414; -pub const SMB_NTSTATUS_HUNG_DISPLAY_DRIVER_THREAD: u32 = 0xc0000415; -pub const SMB_NTSTATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: u32 = 0xc0000416; -pub const SMB_NTSTATUS_INVALID_CRUNTIME_PARAMETER: u32 = 0xc0000417; -pub const SMB_NTSTATUS_NTLM_BLOCKED: u32 = 0xc0000418; -pub const SMB_NTSTATUS_DS_SRC_SID_EXISTS_IN_FOREST: u32 = 0xc0000419; -pub const SMB_NTSTATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST: u32 = 0xc000041a; -pub const SMB_NTSTATUS_DS_FLAT_NAME_EXISTS_IN_FOREST: u32 = 0xc000041b; -pub const SMB_NTSTATUS_INVALID_USER_PRINCIPAL_NAME: u32 = 0xc000041c; -pub const SMB_NTSTATUS_ASSERTION_FAILURE: u32 = 0xc0000420; -pub const SMB_NTSTATUS_VERIFIER_STOP: u32 = 0xc0000421; -pub const SMB_NTSTATUS_CALLBACK_POP_STACK: u32 = 0xc0000423; -pub const SMB_NTSTATUS_INCOMPATIBLE_DRIVER_BLOCKED: u32 = 0xc0000424; -pub const SMB_NTSTATUS_HIVE_UNLOADED: u32 = 0xc0000425; -pub const SMB_NTSTATUS_COMPRESSION_DISABLED: u32 = 0xc0000426; -pub const SMB_NTSTATUS_FILE_SYSTEM_LIMITATION: u32 = 0xc0000427; -pub const SMB_NTSTATUS_INVALID_IMAGE_HASH: u32 = 0xc0000428; -pub const SMB_NTSTATUS_NOT_CAPABLE: u32 = 0xc0000429; -pub const SMB_NTSTATUS_REQUEST_OUT_OF_SEQUENCE: u32 = 0xc000042a; -pub const SMB_NTSTATUS_IMPLEMENTATION_LIMIT: u32 = 0xc000042b; -pub const SMB_NTSTATUS_ELEVATION_REQUIRED: u32 = 0xc000042c; -pub const SMB_NTSTATUS_NO_SECURITY_CONTEXT: u32 = 0xc000042d; -pub const SMB_NTSTATUS_PKU2U_CERT_FAILURE: u32 = 0xc000042e; -pub const SMB_NTSTATUS_BEYOND_VDL: u32 = 0xc0000432; -pub const SMB_NTSTATUS_ENCOUNTERED_WRITE_IN_PROGRESS: u32 = 0xc0000433; -pub const SMB_NTSTATUS_PTE_CHANGED: u32 = 0xc0000434; -pub const SMB_NTSTATUS_PURGE_FAILED: u32 = 0xc0000435; -pub const SMB_NTSTATUS_CRED_REQUIRES_CONFIRMATION: u32 = 0xc0000440; -pub const SMB_NTSTATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: u32 = 0xc0000441; -pub const SMB_NTSTATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER: u32 = 0xc0000442; -pub const SMB_NTSTATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: u32 = 0xc0000443; -pub const SMB_NTSTATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: u32 = 0xc0000444; -pub const SMB_NTSTATUS_CS_ENCRYPTION_FILE_NOT_CSE: u32 = 0xc0000445; -pub const SMB_NTSTATUS_INVALID_LABEL: u32 = 0xc0000446; -pub const SMB_NTSTATUS_DRIVER_PROCESS_TERMINATED: u32 = 0xc0000450; -pub const SMB_NTSTATUS_AMBIGUOUS_SYSTEM_DEVICE: u32 = 0xc0000451; -pub const SMB_NTSTATUS_SYSTEM_DEVICE_NOT_FOUND: u32 = 0xc0000452; -pub const SMB_NTSTATUS_RESTART_BOOT_APPLICATION: u32 = 0xc0000453; -pub const SMB_NTSTATUS_INSUFFICIENT_NVRAM_RESOURCES: u32 = 0xc0000454; -pub const SMB_NTSTATUS_NO_RANGES_PROCESSED: u32 = 0xc0000460; -pub const SMB_NTSTATUS_DEVICE_FEATURE_NOT_SUPPORTED: u32 = 0xc0000463; -pub const SMB_NTSTATUS_DEVICE_UNREACHABLE: u32 = 0xc0000464; -pub const SMB_NTSTATUS_INVALID_TOKEN: u32 = 0xc0000465; -pub const SMB_NTSTATUS_SERVER_UNAVAILABLE: u32 = 0xc0000466; -pub const SMB_NTSTATUS_INVALID_TASK_NAME: u32 = 0xc0000500; -pub const SMB_NTSTATUS_INVALID_TASK_INDEX: u32 = 0xc0000501; -pub const SMB_NTSTATUS_THREAD_ALREADY_IN_TASK: u32 = 0xc0000502; -pub const SMB_NTSTATUS_CALLBACK_BYPASS: u32 = 0xc0000503; -pub const SMB_NTSTATUS_FAIL_FAST_EXCEPTION: u32 = 0xc0000602; -pub const SMB_NTSTATUS_IMAGE_CERT_REVOKED: u32 = 0xc0000603; -pub const SMB_NTSTATUS_PORT_CLOSED: u32 = 0xc0000700; -pub const SMB_NTSTATUS_MESSAGE_LOST: u32 = 0xc0000701; -pub const SMB_NTSTATUS_INVALID_MESSAGE: u32 = 0xc0000702; -pub const SMB_NTSTATUS_REQUEST_CANCELED: u32 = 0xc0000703; -pub const SMB_NTSTATUS_RECURSIVE_DISPATCH: u32 = 0xc0000704; -pub const SMB_NTSTATUS_LPC_RECEIVE_BUFFER_EXPECTED: u32 = 0xc0000705; -pub const SMB_NTSTATUS_LPC_INVALID_CONNECTION_USAGE: u32 = 0xc0000706; -pub const SMB_NTSTATUS_LPC_REQUESTS_NOT_ALLOWED: u32 = 0xc0000707; -pub const SMB_NTSTATUS_RESOURCE_IN_USE: u32 = 0xc0000708; -pub const SMB_NTSTATUS_HARDWARE_MEMORY_ERROR: u32 = 0xc0000709; -pub const SMB_NTSTATUS_THREADPOOL_HANDLE_EXCEPTION: u32 = 0xc000070a; -pub const SMB_NTSTATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED: u32 = 0xc000070b; -pub const SMB_NTSTATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED: u32 = 0xc000070c; -pub const SMB_NTSTATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED: u32 = 0xc000070d; -pub const SMB_NTSTATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED: u32 = 0xc000070e; -pub const SMB_NTSTATUS_THREADPOOL_RELEASED_DURING_OPERATION: u32 = 0xc000070f; -pub const SMB_NTSTATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING: u32 = 0xc0000710; -pub const SMB_NTSTATUS_APC_RETURNED_WHILE_IMPERSONATING: u32 = 0xc0000711; -pub const SMB_NTSTATUS_PROCESS_IS_PROTECTED: u32 = 0xc0000712; -pub const SMB_NTSTATUS_MCA_EXCEPTION: u32 = 0xc0000713; -pub const SMB_NTSTATUS_CERTIFICATE_MAPPING_NOT_UNIQUE: u32 = 0xc0000714; -pub const SMB_NTSTATUS_SYMLINK_CLASS_DISABLED: u32 = 0xc0000715; -pub const SMB_NTSTATUS_INVALID_IDN_NORMALIZATION: u32 = 0xc0000716; -pub const SMB_NTSTATUS_NO_UNICODE_TRANSLATION: u32 = 0xc0000717; -pub const SMB_NTSTATUS_ALREADY_REGISTERED: u32 = 0xc0000718; -pub const SMB_NTSTATUS_CONTEXT_MISMATCH: u32 = 0xc0000719; -pub const SMB_NTSTATUS_PORT_ALREADY_HAS_COMPLETION_LIST: u32 = 0xc000071a; -pub const SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_PRIORITY: u32 = 0xc000071b; -pub const SMB_NTSTATUS_INVALID_THREAD: u32 = 0xc000071c; -pub const SMB_NTSTATUS_CALLBACK_RETURNED_TRANSACTION: u32 = 0xc000071d; -pub const SMB_NTSTATUS_CALLBACK_RETURNED_LDR_LOCK: u32 = 0xc000071e; -pub const SMB_NTSTATUS_CALLBACK_RETURNED_LANG: u32 = 0xc000071f; -pub const SMB_NTSTATUS_CALLBACK_RETURNED_PRI_BACK: u32 = 0xc0000720; -pub const SMB_NTSTATUS_DISK_REPAIR_DISABLED: u32 = 0xc0000800; -pub const SMB_NTSTATUS_DS_DOMAIN_RENAME_IN_PROGRESS: u32 = 0xc0000801; -pub const SMB_NTSTATUS_DISK_QUOTA_EXCEEDED: u32 = 0xc0000802; -pub const SMB_NTSTATUS_CONTENT_BLOCKED: u32 = 0xc0000804; -pub const SMB_NTSTATUS_BAD_CLUSTERS: u32 = 0xc0000805; -pub const SMB_NTSTATUS_VOLUME_DIRTY: u32 = 0xc0000806; -pub const SMB_NTSTATUS_FILE_CHECKED_OUT: u32 = 0xc0000901; -pub const SMB_NTSTATUS_CHECKOUT_REQUIRED: u32 = 0xc0000902; -pub const SMB_NTSTATUS_BAD_FILE_TYPE: u32 = 0xc0000903; -pub const SMB_NTSTATUS_FILE_TOO_LARGE: u32 = 0xc0000904; -pub const SMB_NTSTATUS_FORMS_AUTH_REQUIRED: u32 = 0xc0000905; -pub const SMB_NTSTATUS_VIRUS_INFECTED: u32 = 0xc0000906; -pub const SMB_NTSTATUS_VIRUS_DELETED: u32 = 0xc0000907; -pub const SMB_NTSTATUS_BAD_MCFG_TABLE: u32 = 0xc0000908; -pub const SMB_NTSTATUS_CANNOT_BREAK_OPLOCK: u32 = 0xc0000909; -pub const SMB_NTSTATUS_WOW_ASSERTION: u32 = 0xc0009898; -pub const SMB_NTSTATUS_INVALID_SIGNATURE: u32 = 0xc000a000; -pub const SMB_NTSTATUS_HMAC_NOT_SUPPORTED: u32 = 0xc000a001; -pub const SMB_NTSTATUS_IPSEC_QUEUE_OVERFLOW: u32 = 0xc000a010; -pub const SMB_NTSTATUS_ND_QUEUE_OVERFLOW: u32 = 0xc000a011; -pub const SMB_NTSTATUS_HOPLIMIT_EXCEEDED: u32 = 0xc000a012; -pub const SMB_NTSTATUS_PROTOCOL_NOT_SUPPORTED: u32 = 0xc000a013; -pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: u32 = 0xc000a080; -pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: u32 = 0xc000a081; -pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: u32 = 0xc000a082; -pub const SMB_NTSTATUS_XML_PARSE_ERROR: u32 = 0xc000a083; -pub const SMB_NTSTATUS_XMLDSIG_ERROR: u32 = 0xc000a084; -pub const SMB_NTSTATUS_WRONG_COMPARTMENT: u32 = 0xc000a085; -pub const SMB_NTSTATUS_AUTHIP_FAILURE: u32 = 0xc000a086; -pub const SMB_NTSTATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: u32 = 0xc000a087; -pub const SMB_NTSTATUS_DS_OID_NOT_FOUND: u32 = 0xc000a088; -pub const SMB_NTSTATUS_HASH_NOT_SUPPORTED: u32 = 0xc000a100; -pub const SMB_NTSTATUS_HASH_NOT_PRESENT: u32 = 0xc000a101; -pub const SMB_NTSTATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED: u32 = 0xc000a2a1; -pub const SMB_NTSTATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: u32 = 0xc000a2a2; -pub const SMB_NTSTATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED: u32 = 0xc000a2a3; -pub const SMB_NTSTATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: u32 = 0xc000a2a4; -pub const SMB_NTDBG_NO_STATE_CHANGE: u32 = 0xc0010001; -pub const SMB_NTDBG_APP_NOT_IDLE: u32 = 0xc0010002; -pub const SMB_NTRPC_NT_INVALID_STRING_BINDING: u32 = 0xc0020001; -pub const SMB_NTRPC_NT_WRONG_KIND_OF_BINDING: u32 = 0xc0020002; -pub const SMB_NTRPC_NT_INVALID_BINDING: u32 = 0xc0020003; -pub const SMB_NTRPC_NT_PROTSEQ_NOT_SUPPORTED: u32 = 0xc0020004; -pub const SMB_NTRPC_NT_INVALID_RPC_PROTSEQ: u32 = 0xc0020005; -pub const SMB_NTRPC_NT_INVALID_STRING_UUID: u32 = 0xc0020006; -pub const SMB_NTRPC_NT_INVALID_ENDPOINT_FORMAT: u32 = 0xc0020007; -pub const SMB_NTRPC_NT_INVALID_NET_ADDR: u32 = 0xc0020008; -pub const SMB_NTRPC_NT_NO_ENDPOINT_FOUND: u32 = 0xc0020009; -pub const SMB_NTRPC_NT_INVALID_TIMEOUT: u32 = 0xc002000a; -pub const SMB_NTRPC_NT_OBJECT_NOT_FOUND: u32 = 0xc002000b; -pub const SMB_NTRPC_NT_ALREADY_REGISTERED: u32 = 0xc002000c; -pub const SMB_NTRPC_NT_TYPE_ALREADY_REGISTERED: u32 = 0xc002000d; -pub const SMB_NTRPC_NT_ALREADY_LISTENING: u32 = 0xc002000e; -pub const SMB_NTRPC_NT_NO_PROTSEQS_REGISTERED: u32 = 0xc002000f; -pub const SMB_NTRPC_NT_NOT_LISTENING: u32 = 0xc0020010; -pub const SMB_NTRPC_NT_UNKNOWN_MGR_TYPE: u32 = 0xc0020011; -pub const SMB_NTRPC_NT_UNKNOWN_IF: u32 = 0xc0020012; -pub const SMB_NTRPC_NT_NO_BINDINGS: u32 = 0xc0020013; -pub const SMB_NTRPC_NT_NO_PROTSEQS: u32 = 0xc0020014; -pub const SMB_NTRPC_NT_CANT_CREATE_ENDPOINT: u32 = 0xc0020015; -pub const SMB_NTRPC_NT_OUT_OF_RESOURCES: u32 = 0xc0020016; -pub const SMB_NTRPC_NT_SERVER_UNAVAILABLE: u32 = 0xc0020017; -pub const SMB_NTRPC_NT_SERVER_TOO_BUSY: u32 = 0xc0020018; -pub const SMB_NTRPC_NT_INVALID_NETWORK_OPTIONS: u32 = 0xc0020019; -pub const SMB_NTRPC_NT_NO_CALL_ACTIVE: u32 = 0xc002001a; -pub const SMB_NTRPC_NT_CALL_FAILED: u32 = 0xc002001b; -pub const SMB_NTRPC_NT_CALL_FAILED_DNE: u32 = 0xc002001c; -pub const SMB_NTRPC_NT_PROTOCOL_ERROR: u32 = 0xc002001d; -pub const SMB_NTRPC_NT_UNSUPPORTED_TRANS_SYN: u32 = 0xc002001f; -pub const SMB_NTRPC_NT_UNSUPPORTED_TYPE: u32 = 0xc0020021; -pub const SMB_NTRPC_NT_INVALID_TAG: u32 = 0xc0020022; -pub const SMB_NTRPC_NT_INVALID_BOUND: u32 = 0xc0020023; -pub const SMB_NTRPC_NT_NO_ENTRY_NAME: u32 = 0xc0020024; -pub const SMB_NTRPC_NT_INVALID_NAME_SYNTAX: u32 = 0xc0020025; -pub const SMB_NTRPC_NT_UNSUPPORTED_NAME_SYNTAX: u32 = 0xc0020026; -pub const SMB_NTRPC_NT_UUID_NO_ADDRESS: u32 = 0xc0020028; -pub const SMB_NTRPC_NT_DUPLICATE_ENDPOINT: u32 = 0xc0020029; -pub const SMB_NTRPC_NT_UNKNOWN_AUTHN_TYPE: u32 = 0xc002002a; -pub const SMB_NTRPC_NT_MAX_CALLS_TOO_SMALL: u32 = 0xc002002b; -pub const SMB_NTRPC_NT_STRING_TOO_LONG: u32 = 0xc002002c; -pub const SMB_NTRPC_NT_PROTSEQ_NOT_FOUND: u32 = 0xc002002d; -pub const SMB_NTRPC_NT_PROCNUM_OUT_OF_RANGE: u32 = 0xc002002e; -pub const SMB_NTRPC_NT_BINDING_HAS_NO_AUTH: u32 = 0xc002002f; -pub const SMB_NTRPC_NT_UNKNOWN_AUTHN_SERVICE: u32 = 0xc0020030; -pub const SMB_NTRPC_NT_UNKNOWN_AUTHN_LEVEL: u32 = 0xc0020031; -pub const SMB_NTRPC_NT_INVALID_AUTH_IDENTITY: u32 = 0xc0020032; -pub const SMB_NTRPC_NT_UNKNOWN_AUTHZ_SERVICE: u32 = 0xc0020033; -pub const SMB_NTEPT_NT_INVALID_ENTRY: u32 = 0xc0020034; -pub const SMB_NTEPT_NT_CANT_PERFORM_OP: u32 = 0xc0020035; -pub const SMB_NTEPT_NT_NOT_REGISTERED: u32 = 0xc0020036; -pub const SMB_NTRPC_NT_NOTHING_TO_EXPORT: u32 = 0xc0020037; -pub const SMB_NTRPC_NT_INCOMPLETE_NAME: u32 = 0xc0020038; -pub const SMB_NTRPC_NT_INVALID_VERS_OPTION: u32 = 0xc0020039; -pub const SMB_NTRPC_NT_NO_MORE_MEMBERS: u32 = 0xc002003a; -pub const SMB_NTRPC_NT_NOT_ALL_OBJS_UNEXPORTED: u32 = 0xc002003b; -pub const SMB_NTRPC_NT_INTERFACE_NOT_FOUND: u32 = 0xc002003c; -pub const SMB_NTRPC_NT_ENTRY_ALREADY_EXISTS: u32 = 0xc002003d; -pub const SMB_NTRPC_NT_ENTRY_NOT_FOUND: u32 = 0xc002003e; -pub const SMB_NTRPC_NT_NAME_SERVICE_UNAVAILABLE: u32 = 0xc002003f; -pub const SMB_NTRPC_NT_INVALID_NAF_ID: u32 = 0xc0020040; -pub const SMB_NTRPC_NT_CANNOT_SUPPORT: u32 = 0xc0020041; -pub const SMB_NTRPC_NT_NO_CONTEXT_AVAILABLE: u32 = 0xc0020042; -pub const SMB_NTRPC_NT_INTERNAL_ERROR: u32 = 0xc0020043; -pub const SMB_NTRPC_NT_ZERO_DIVIDE: u32 = 0xc0020044; -pub const SMB_NTRPC_NT_ADDRESS_ERROR: u32 = 0xc0020045; -pub const SMB_NTRPC_NT_FP_DIV_ZERO: u32 = 0xc0020046; -pub const SMB_NTRPC_NT_FP_UNDERFLOW: u32 = 0xc0020047; -pub const SMB_NTRPC_NT_FP_OVERFLOW: u32 = 0xc0020048; -pub const SMB_NTRPC_NT_CALL_IN_PROGRESS: u32 = 0xc0020049; -pub const SMB_NTRPC_NT_NO_MORE_BINDINGS: u32 = 0xc002004a; -pub const SMB_NTRPC_NT_GROUP_MEMBER_NOT_FOUND: u32 = 0xc002004b; -pub const SMB_NTEPT_NT_CANT_CREATE: u32 = 0xc002004c; -pub const SMB_NTRPC_NT_INVALID_OBJECT: u32 = 0xc002004d; -pub const SMB_NTRPC_NT_NO_INTERFACES: u32 = 0xc002004f; -pub const SMB_NTRPC_NT_CALL_CANCELLED: u32 = 0xc0020050; -pub const SMB_NTRPC_NT_BINDING_INCOMPLETE: u32 = 0xc0020051; -pub const SMB_NTRPC_NT_COMM_FAILURE: u32 = 0xc0020052; -pub const SMB_NTRPC_NT_UNSUPPORTED_AUTHN_LEVEL: u32 = 0xc0020053; -pub const SMB_NTRPC_NT_NO_PRINC_NAME: u32 = 0xc0020054; -pub const SMB_NTRPC_NT_NOT_RPC_ERROR: u32 = 0xc0020055; -pub const SMB_NTRPC_NT_SEC_PKG_ERROR: u32 = 0xc0020057; -pub const SMB_NTRPC_NT_NOT_CANCELLED: u32 = 0xc0020058; -pub const SMB_NTRPC_NT_INVALID_ASYNC_HANDLE: u32 = 0xc0020062; -pub const SMB_NTRPC_NT_INVALID_ASYNC_CALL: u32 = 0xc0020063; -pub const SMB_NTRPC_NT_PROXY_ACCESS_DENIED: u32 = 0xc0020064; -pub const SMB_NTRPC_NT_NO_MORE_ENTRIES: u32 = 0xc0030001; -pub const SMB_NTRPC_NT_SS_CHAR_TRANS_OPEN_FAIL: u32 = 0xc0030002; -pub const SMB_NTRPC_NT_SS_CHAR_TRANS_SHORT_FILE: u32 = 0xc0030003; -pub const SMB_NTRPC_NT_SS_IN_NULL_CONTEXT: u32 = 0xc0030004; -pub const SMB_NTRPC_NT_SS_CONTEXT_MISMATCH: u32 = 0xc0030005; -pub const SMB_NTRPC_NT_SS_CONTEXT_DAMAGED: u32 = 0xc0030006; -pub const SMB_NTRPC_NT_SS_HANDLES_MISMATCH: u32 = 0xc0030007; -pub const SMB_NTRPC_NT_SS_CANNOT_GET_CALL_HANDLE: u32 = 0xc0030008; -pub const SMB_NTRPC_NT_NULL_REF_POINTER: u32 = 0xc0030009; -pub const SMB_NTRPC_NT_ENUM_VALUE_OUT_OF_RANGE: u32 = 0xc003000a; -pub const SMB_NTRPC_NT_BYTE_COUNT_TOO_SMALL: u32 = 0xc003000b; -pub const SMB_NTRPC_NT_BAD_STUB_DATA: u32 = 0xc003000c; -pub const SMB_NTRPC_NT_INVALID_ES_ACTION: u32 = 0xc0030059; -pub const SMB_NTRPC_NT_WRONG_ES_VERSION: u32 = 0xc003005a; -pub const SMB_NTRPC_NT_WRONG_STUB_VERSION: u32 = 0xc003005b; -pub const SMB_NTRPC_NT_INVALID_PIPE_OBJECT: u32 = 0xc003005c; -pub const SMB_NTRPC_NT_INVALID_PIPE_OPERATION: u32 = 0xc003005d; -pub const SMB_NTRPC_NT_WRONG_PIPE_VERSION: u32 = 0xc003005e; -pub const SMB_NTRPC_NT_PIPE_CLOSED: u32 = 0xc003005f; -pub const SMB_NTRPC_NT_PIPE_DISCIPLINE_ERROR: u32 = 0xc0030060; -pub const SMB_NTRPC_NT_PIPE_EMPTY: u32 = 0xc0030061; -pub const SMB_NTSTATUS_PNP_BAD_MPS_TABLE: u32 = 0xc0040035; -pub const SMB_NTSTATUS_PNP_TRANSLATION_FAILED: u32 = 0xc0040036; -pub const SMB_NTSTATUS_PNP_IRQ_TRANSLATION_FAILED: u32 = 0xc0040037; -pub const SMB_NTSTATUS_PNP_INVALID_ID: u32 = 0xc0040038; -pub const SMB_NTSTATUS_IO_REISSUE_AS_CACHED: u32 = 0xc0040039; -pub const SMB_NTSTATUS_CTX_WINSTATION_NAME_INVALID: u32 = 0xc00a0001; -pub const SMB_NTSTATUS_CTX_INVALID_PD: u32 = 0xc00a0002; -pub const SMB_NTSTATUS_CTX_PD_NOT_FOUND: u32 = 0xc00a0003; -pub const SMB_NTSTATUS_CTX_CLOSE_PENDING: u32 = 0xc00a0006; -pub const SMB_NTSTATUS_CTX_NO_OUTBUF: u32 = 0xc00a0007; -pub const SMB_NTSTATUS_CTX_MODEM_INF_NOT_FOUND: u32 = 0xc00a0008; -pub const SMB_NTSTATUS_CTX_INVALID_MODEMNAME: u32 = 0xc00a0009; -pub const SMB_NTSTATUS_CTX_RESPONSE_ERROR: u32 = 0xc00a000a; -pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_TIMEOUT: u32 = 0xc00a000b; -pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_CARRIER: u32 = 0xc00a000c; -pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_DIALTONE: u32 = 0xc00a000d; -pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_BUSY: u32 = 0xc00a000e; -pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_VOICE: u32 = 0xc00a000f; -pub const SMB_NTSTATUS_CTX_TD_ERROR: u32 = 0xc00a0010; -pub const SMB_NTSTATUS_CTX_LICENSE_CLIENT_INVALID: u32 = 0xc00a0012; -pub const SMB_NTSTATUS_CTX_LICENSE_NOT_AVAILABLE: u32 = 0xc00a0013; -pub const SMB_NTSTATUS_CTX_LICENSE_EXPIRED: u32 = 0xc00a0014; -pub const SMB_NTSTATUS_CTX_WINSTATION_NOT_FOUND: u32 = 0xc00a0015; -pub const SMB_NTSTATUS_CTX_WINSTATION_NAME_COLLISION: u32 = 0xc00a0016; -pub const SMB_NTSTATUS_CTX_WINSTATION_BUSY: u32 = 0xc00a0017; -pub const SMB_NTSTATUS_CTX_BAD_VIDEO_MODE: u32 = 0xc00a0018; -pub const SMB_NTSTATUS_CTX_GRAPHICS_INVALID: u32 = 0xc00a0022; -pub const SMB_NTSTATUS_CTX_NOT_CONSOLE: u32 = 0xc00a0024; -pub const SMB_NTSTATUS_CTX_CLIENT_QUERY_TIMEOUT: u32 = 0xc00a0026; -pub const SMB_NTSTATUS_CTX_CONSOLE_DISCONNECT: u32 = 0xc00a0027; -pub const SMB_NTSTATUS_CTX_CONSOLE_CONNECT: u32 = 0xc00a0028; -pub const SMB_NTSTATUS_CTX_SHADOW_DENIED: u32 = 0xc00a002a; -pub const SMB_NTSTATUS_CTX_WINSTATION_ACCESS_DENIED: u32 = 0xc00a002b; -pub const SMB_NTSTATUS_CTX_INVALID_WD: u32 = 0xc00a002e; -pub const SMB_NTSTATUS_CTX_WD_NOT_FOUND: u32 = 0xc00a002f; -pub const SMB_NTSTATUS_CTX_SHADOW_INVALID: u32 = 0xc00a0030; -pub const SMB_NTSTATUS_CTX_SHADOW_DISABLED: u32 = 0xc00a0031; -pub const SMB_NTSTATUS_RDP_PROTOCOL_ERROR: u32 = 0xc00a0032; -pub const SMB_NTSTATUS_CTX_CLIENT_LICENSE_NOT_SET: u32 = 0xc00a0033; -pub const SMB_NTSTATUS_CTX_CLIENT_LICENSE_IN_USE: u32 = 0xc00a0034; -pub const SMB_NTSTATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE: u32 = 0xc00a0035; -pub const SMB_NTSTATUS_CTX_SHADOW_NOT_RUNNING: u32 = 0xc00a0036; -pub const SMB_NTSTATUS_CTX_LOGON_DISABLED: u32 = 0xc00a0037; -pub const SMB_NTSTATUS_CTX_SECURITY_LAYER_ERROR: u32 = 0xc00a0038; -pub const SMB_NTSTATUS_TS_INCOMPATIBLE_SESSIONS: u32 = 0xc00a0039; -pub const SMB_NTSTATUS_MUI_FILE_NOT_FOUND: u32 = 0xc00b0001; -pub const SMB_NTSTATUS_MUI_INVALID_FILE: u32 = 0xc00b0002; -pub const SMB_NTSTATUS_MUI_INVALID_RC_CONFIG: u32 = 0xc00b0003; -pub const SMB_NTSTATUS_MUI_INVALID_LOCALE_NAME: u32 = 0xc00b0004; -pub const SMB_NTSTATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME: u32 = 0xc00b0005; -pub const SMB_NTSTATUS_MUI_FILE_NOT_LOADED: u32 = 0xc00b0006; -pub const SMB_NTSTATUS_RESOURCE_ENUM_USER_STOP: u32 = 0xc00b0007; -pub const SMB_NTSTATUS_CLUSTER_INVALID_NODE: u32 = 0xc0130001; -pub const SMB_NTSTATUS_CLUSTER_NODE_EXISTS: u32 = 0xc0130002; -pub const SMB_NTSTATUS_CLUSTER_JOIN_IN_PROGRESS: u32 = 0xc0130003; -pub const SMB_NTSTATUS_CLUSTER_NODE_NOT_FOUND: u32 = 0xc0130004; -pub const SMB_NTSTATUS_CLUSTER_LOCAL_NODE_NOT_FOUND: u32 = 0xc0130005; -pub const SMB_NTSTATUS_CLUSTER_NETWORK_EXISTS: u32 = 0xc0130006; -pub const SMB_NTSTATUS_CLUSTER_NETWORK_NOT_FOUND: u32 = 0xc0130007; -pub const SMB_NTSTATUS_CLUSTER_NETINTERFACE_EXISTS: u32 = 0xc0130008; -pub const SMB_NTSTATUS_CLUSTER_NETINTERFACE_NOT_FOUND: u32 = 0xc0130009; -pub const SMB_NTSTATUS_CLUSTER_INVALID_REQUEST: u32 = 0xc013000a; -pub const SMB_NTSTATUS_CLUSTER_INVALID_NETWORK_PROVIDER: u32 = 0xc013000b; -pub const SMB_NTSTATUS_CLUSTER_NODE_DOWN: u32 = 0xc013000c; -pub const SMB_NTSTATUS_CLUSTER_NODE_UNREACHABLE: u32 = 0xc013000d; -pub const SMB_NTSTATUS_CLUSTER_NODE_NOT_MEMBER: u32 = 0xc013000e; -pub const SMB_NTSTATUS_CLUSTER_JOIN_NOT_IN_PROGRESS: u32 = 0xc013000f; -pub const SMB_NTSTATUS_CLUSTER_INVALID_NETWORK: u32 = 0xc0130010; -pub const SMB_NTSTATUS_CLUSTER_NO_NET_ADAPTERS: u32 = 0xc0130011; -pub const SMB_NTSTATUS_CLUSTER_NODE_UP: u32 = 0xc0130012; -pub const SMB_NTSTATUS_CLUSTER_NODE_PAUSED: u32 = 0xc0130013; -pub const SMB_NTSTATUS_CLUSTER_NODE_NOT_PAUSED: u32 = 0xc0130014; -pub const SMB_NTSTATUS_CLUSTER_NO_SECURITY_CONTEXT: u32 = 0xc0130015; -pub const SMB_NTSTATUS_CLUSTER_NETWORK_NOT_INTERNAL: u32 = 0xc0130016; -pub const SMB_NTSTATUS_CLUSTER_POISONED: u32 = 0xc0130017; -pub const SMB_NTSTATUS_ACPI_INVALID_OPCODE: u32 = 0xc0140001; -pub const SMB_NTSTATUS_ACPI_STACK_OVERFLOW: u32 = 0xc0140002; -pub const SMB_NTSTATUS_ACPI_ASSERT_FAILED: u32 = 0xc0140003; -pub const SMB_NTSTATUS_ACPI_INVALID_INDEX: u32 = 0xc0140004; -pub const SMB_NTSTATUS_ACPI_INVALID_ARGUMENT: u32 = 0xc0140005; -pub const SMB_NTSTATUS_ACPI_FATAL: u32 = 0xc0140006; -pub const SMB_NTSTATUS_ACPI_INVALID_SUPERNAME: u32 = 0xc0140007; -pub const SMB_NTSTATUS_ACPI_INVALID_ARGTYPE: u32 = 0xc0140008; -pub const SMB_NTSTATUS_ACPI_INVALID_OBJTYPE: u32 = 0xc0140009; -pub const SMB_NTSTATUS_ACPI_INVALID_TARGETTYPE: u32 = 0xc014000a; -pub const SMB_NTSTATUS_ACPI_INCORRECT_ARGUMENT_COUNT: u32 = 0xc014000b; -pub const SMB_NTSTATUS_ACPI_ADDRESS_NOT_MAPPED: u32 = 0xc014000c; -pub const SMB_NTSTATUS_ACPI_INVALID_EVENTTYPE: u32 = 0xc014000d; -pub const SMB_NTSTATUS_ACPI_HANDLER_COLLISION: u32 = 0xc014000e; -pub const SMB_NTSTATUS_ACPI_INVALID_DATA: u32 = 0xc014000f; -pub const SMB_NTSTATUS_ACPI_INVALID_REGION: u32 = 0xc0140010; -pub const SMB_NTSTATUS_ACPI_INVALID_ACCESS_SIZE: u32 = 0xc0140011; -pub const SMB_NTSTATUS_ACPI_ACQUIRE_GLOBAL_LOCK: u32 = 0xc0140012; -pub const SMB_NTSTATUS_ACPI_ALREADY_INITIALIZED: u32 = 0xc0140013; -pub const SMB_NTSTATUS_ACPI_NOT_INITIALIZED: u32 = 0xc0140014; -pub const SMB_NTSTATUS_ACPI_INVALID_MUTEX_LEVEL: u32 = 0xc0140015; -pub const SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNED: u32 = 0xc0140016; -pub const SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNER: u32 = 0xc0140017; -pub const SMB_NTSTATUS_ACPI_RS_ACCESS: u32 = 0xc0140018; -pub const SMB_NTSTATUS_ACPI_INVALID_TABLE: u32 = 0xc0140019; -pub const SMB_NTSTATUS_ACPI_REG_HANDLER_FAILED: u32 = 0xc0140020; -pub const SMB_NTSTATUS_ACPI_POWER_REQUEST_FAILED: u32 = 0xc0140021; -pub const SMB_NTSTATUS_SXS_SECTION_NOT_FOUND: u32 = 0xc0150001; -pub const SMB_NTSTATUS_SXS_CANT_GEN_ACTCTX: u32 = 0xc0150002; -pub const SMB_NTSTATUS_SXS_INVALID_ACTCTXDATA_FORMAT: u32 = 0xc0150003; -pub const SMB_NTSTATUS_SXS_ASSEMBLY_NOT_FOUND: u32 = 0xc0150004; -pub const SMB_NTSTATUS_SXS_MANIFEST_FORMAT_ERROR: u32 = 0xc0150005; -pub const SMB_NTSTATUS_SXS_MANIFEST_PARSE_ERROR: u32 = 0xc0150006; -pub const SMB_NTSTATUS_SXS_ACTIVATION_CONTEXT_DISABLED: u32 = 0xc0150007; -pub const SMB_NTSTATUS_SXS_KEY_NOT_FOUND: u32 = 0xc0150008; -pub const SMB_NTSTATUS_SXS_VERSION_CONFLICT: u32 = 0xc0150009; -pub const SMB_NTSTATUS_SXS_WRONG_SECTION_TYPE: u32 = 0xc015000a; -pub const SMB_NTSTATUS_SXS_THREAD_QUERIES_DISABLED: u32 = 0xc015000b; -pub const SMB_NTSTATUS_SXS_ASSEMBLY_MISSING: u32 = 0xc015000c; -pub const SMB_NTSTATUS_SXS_PROCESS_DEFAULT_ALREADY_SET: u32 = 0xc015000e; -pub const SMB_NTSTATUS_SXS_EARLY_DEACTIVATION: u32 = 0xc015000f; -pub const SMB_NTSTATUS_SXS_INVALID_DEACTIVATION: u32 = 0xc0150010; -pub const SMB_NTSTATUS_SXS_MULTIPLE_DEACTIVATION: u32 = 0xc0150011; -pub const SMB_NTSTATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: u32 = 0xc0150012; -pub const SMB_NTSTATUS_SXS_PROCESS_TERMINATION_REQUESTED: u32 = 0xc0150013; -pub const SMB_NTSTATUS_SXS_CORRUPT_ACTIVATION_STACK: u32 = 0xc0150014; -pub const SMB_NTSTATUS_SXS_CORRUPTION: u32 = 0xc0150015; -pub const SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: u32 = 0xc0150016; -pub const SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: u32 = 0xc0150017; -pub const SMB_NTSTATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: u32 = 0xc0150018; -pub const SMB_NTSTATUS_SXS_IDENTITY_PARSE_ERROR: u32 = 0xc0150019; -pub const SMB_NTSTATUS_SXS_COMPONENT_STORE_CORRUPT: u32 = 0xc015001a; -pub const SMB_NTSTATUS_SXS_FILE_HASH_MISMATCH: u32 = 0xc015001b; -pub const SMB_NTSTATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: u32 = 0xc015001c; -pub const SMB_NTSTATUS_SXS_IDENTITIES_DIFFERENT: u32 = 0xc015001d; -pub const SMB_NTSTATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: u32 = 0xc015001e; -pub const SMB_NTSTATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY: u32 = 0xc015001f; -pub const SMB_NTSTATUS_ADVANCED_INSTALLER_FAILED: u32 = 0xc0150020; -pub const SMB_NTSTATUS_XML_ENCODING_MISMATCH: u32 = 0xc0150021; -pub const SMB_NTSTATUS_SXS_MANIFEST_TOO_BIG: u32 = 0xc0150022; -pub const SMB_NTSTATUS_SXS_SETTING_NOT_REGISTERED: u32 = 0xc0150023; -pub const SMB_NTSTATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE: u32 = 0xc0150024; -pub const SMB_NTSTATUS_SMI_PRIMITIVE_INSTALLER_FAILED: u32 = 0xc0150025; -pub const SMB_NTSTATUS_GENERIC_COMMAND_FAILED: u32 = 0xc0150026; -pub const SMB_NTSTATUS_SXS_FILE_HASH_MISSING: u32 = 0xc0150027; -pub const SMB_NTSTATUS_TRANSACTIONAL_CONFLICT: u32 = 0xc0190001; -pub const SMB_NTSTATUS_INVALID_TRANSACTION: u32 = 0xc0190002; -pub const SMB_NTSTATUS_TRANSACTION_NOT_ACTIVE: u32 = 0xc0190003; -pub const SMB_NTSTATUS_TM_INITIALIZATION_FAILED: u32 = 0xc0190004; -pub const SMB_NTSTATUS_RM_NOT_ACTIVE: u32 = 0xc0190005; -pub const SMB_NTSTATUS_RM_METADATA_CORRUPT: u32 = 0xc0190006; -pub const SMB_NTSTATUS_TRANSACTION_NOT_JOINED: u32 = 0xc0190007; -pub const SMB_NTSTATUS_DIRECTORY_NOT_RM: u32 = 0xc0190008; -pub const SMB_NTSTATUS_TRANSACTIONS_UNSUPPORTED_REMOTE: u32 = 0xc019000a; -pub const SMB_NTSTATUS_LOG_RESIZE_INVALID_SIZE: u32 = 0xc019000b; -pub const SMB_NTSTATUS_REMOTE_FILE_VERSION_MISMATCH: u32 = 0xc019000c; -pub const SMB_NTSTATUS_CRM_PROTOCOL_ALREADY_EXISTS: u32 = 0xc019000f; -pub const SMB_NTSTATUS_TRANSACTION_PROPAGATION_FAILED: u32 = 0xc0190010; -pub const SMB_NTSTATUS_CRM_PROTOCOL_NOT_FOUND: u32 = 0xc0190011; -pub const SMB_NTSTATUS_TRANSACTION_SUPERIOR_EXISTS: u32 = 0xc0190012; -pub const SMB_NTSTATUS_TRANSACTION_REQUEST_NOT_VALID: u32 = 0xc0190013; -pub const SMB_NTSTATUS_TRANSACTION_NOT_REQUESTED: u32 = 0xc0190014; -pub const SMB_NTSTATUS_TRANSACTION_ALREADY_ABORTED: u32 = 0xc0190015; -pub const SMB_NTSTATUS_TRANSACTION_ALREADY_COMMITTED: u32 = 0xc0190016; -pub const SMB_NTSTATUS_TRANSACTION_INVALID_MARSHALL_BUFFER: u32 = 0xc0190017; -pub const SMB_NTSTATUS_CURRENT_TRANSACTION_NOT_VALID: u32 = 0xc0190018; -pub const SMB_NTSTATUS_LOG_GROWTH_FAILED: u32 = 0xc0190019; -pub const SMB_NTSTATUS_OBJECT_NO_LONGER_EXISTS: u32 = 0xc0190021; -pub const SMB_NTSTATUS_STREAM_MINIVERSION_NOT_FOUND: u32 = 0xc0190022; -pub const SMB_NTSTATUS_STREAM_MINIVERSION_NOT_VALID: u32 = 0xc0190023; -pub const SMB_NTSTATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: u32 = 0xc0190024; -pub const SMB_NTSTATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: u32 = 0xc0190025; -pub const SMB_NTSTATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS: u32 = 0xc0190026; -pub const SMB_NTSTATUS_HANDLE_NO_LONGER_VALID: u32 = 0xc0190028; -pub const SMB_NTSTATUS_LOG_CORRUPTION_DETECTED: u32 = 0xc0190030; -pub const SMB_NTSTATUS_RM_DISCONNECTED: u32 = 0xc0190032; -pub const SMB_NTSTATUS_ENLISTMENT_NOT_SUPERIOR: u32 = 0xc0190033; -pub const SMB_NTSTATUS_FILE_IDENTITY_NOT_PERSISTENT: u32 = 0xc0190036; -pub const SMB_NTSTATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: u32 = 0xc0190037; -pub const SMB_NTSTATUS_CANT_CROSS_RM_BOUNDARY: u32 = 0xc0190038; -pub const SMB_NTSTATUS_TXF_DIR_NOT_EMPTY: u32 = 0xc0190039; -pub const SMB_NTSTATUS_INDOUBT_TRANSACTIONS_EXIST: u32 = 0xc019003a; -pub const SMB_NTSTATUS_TM_VOLATILE: u32 = 0xc019003b; -pub const SMB_NTSTATUS_ROLLBACK_TIMER_EXPIRED: u32 = 0xc019003c; -pub const SMB_NTSTATUS_TXF_ATTRIBUTE_CORRUPT: u32 = 0xc019003d; -pub const SMB_NTSTATUS_EFS_NOT_ALLOWED_IN_TRANSACTION: u32 = 0xc019003e; -pub const SMB_NTSTATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED: u32 = 0xc019003f; -pub const SMB_NTSTATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: u32 = 0xc0190040; -pub const SMB_NTSTATUS_TRANSACTION_REQUIRED_PROMOTION: u32 = 0xc0190043; -pub const SMB_NTSTATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION: u32 = 0xc0190044; -pub const SMB_NTSTATUS_TRANSACTIONS_NOT_FROZEN: u32 = 0xc0190045; -pub const SMB_NTSTATUS_TRANSACTION_FREEZE_IN_PROGRESS: u32 = 0xc0190046; -pub const SMB_NTSTATUS_NOT_SNAPSHOT_VOLUME: u32 = 0xc0190047; -pub const SMB_NTSTATUS_NO_SAVEPOINT_WITH_OPEN_FILES: u32 = 0xc0190048; -pub const SMB_NTSTATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION: u32 = 0xc0190049; -pub const SMB_NTSTATUS_TM_IDENTITY_MISMATCH: u32 = 0xc019004a; -pub const SMB_NTSTATUS_FLOATED_SECTION: u32 = 0xc019004b; -pub const SMB_NTSTATUS_CANNOT_ACCEPT_TRANSACTED_WORK: u32 = 0xc019004c; -pub const SMB_NTSTATUS_CANNOT_ABORT_TRANSACTIONS: u32 = 0xc019004d; -pub const SMB_NTSTATUS_TRANSACTION_NOT_FOUND: u32 = 0xc019004e; -pub const SMB_NTSTATUS_RESOURCEMANAGER_NOT_FOUND: u32 = 0xc019004f; -pub const SMB_NTSTATUS_ENLISTMENT_NOT_FOUND: u32 = 0xc0190050; -pub const SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_FOUND: u32 = 0xc0190051; -pub const SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_ONLINE: u32 = 0xc0190052; -pub const SMB_NTSTATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: u32 = 0xc0190053; -pub const SMB_NTSTATUS_TRANSACTION_NOT_ROOT: u32 = 0xc0190054; -pub const SMB_NTSTATUS_TRANSACTION_OBJECT_EXPIRED: u32 = 0xc0190055; -pub const SMB_NTSTATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: u32 = 0xc0190056; -pub const SMB_NTSTATUS_TRANSACTION_RESPONSE_NOT_ENLISTED: u32 = 0xc0190057; -pub const SMB_NTSTATUS_TRANSACTION_RECORD_TOO_LONG: u32 = 0xc0190058; -pub const SMB_NTSTATUS_NO_LINK_TRACKING_IN_TRANSACTION: u32 = 0xc0190059; -pub const SMB_NTSTATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: u32 = 0xc019005a; -pub const SMB_NTSTATUS_TRANSACTION_INTEGRITY_VIOLATED: u32 = 0xc019005b; -pub const SMB_NTSTATUS_EXPIRED_HANDLE: u32 = 0xc0190060; -pub const SMB_NTSTATUS_TRANSACTION_NOT_ENLISTED: u32 = 0xc0190061; -pub const SMB_NTSTATUS_LOG_SECTOR_INVALID: u32 = 0xc01a0001; -pub const SMB_NTSTATUS_LOG_SECTOR_PARITY_INVALID: u32 = 0xc01a0002; -pub const SMB_NTSTATUS_LOG_SECTOR_REMAPPED: u32 = 0xc01a0003; -pub const SMB_NTSTATUS_LOG_BLOCK_INCOMPLETE: u32 = 0xc01a0004; -pub const SMB_NTSTATUS_LOG_INVALID_RANGE: u32 = 0xc01a0005; -pub const SMB_NTSTATUS_LOG_BLOCKS_EXHAUSTED: u32 = 0xc01a0006; -pub const SMB_NTSTATUS_LOG_READ_CONTEXT_INVALID: u32 = 0xc01a0007; -pub const SMB_NTSTATUS_LOG_RESTART_INVALID: u32 = 0xc01a0008; -pub const SMB_NTSTATUS_LOG_BLOCK_VERSION: u32 = 0xc01a0009; -pub const SMB_NTSTATUS_LOG_BLOCK_INVALID: u32 = 0xc01a000a; -pub const SMB_NTSTATUS_LOG_READ_MODE_INVALID: u32 = 0xc01a000b; -pub const SMB_NTSTATUS_LOG_METADATA_CORRUPT: u32 = 0xc01a000d; -pub const SMB_NTSTATUS_LOG_METADATA_INVALID: u32 = 0xc01a000e; -pub const SMB_NTSTATUS_LOG_METADATA_INCONSISTENT: u32 = 0xc01a000f; -pub const SMB_NTSTATUS_LOG_RESERVATION_INVALID: u32 = 0xc01a0010; -pub const SMB_NTSTATUS_LOG_CANT_DELETE: u32 = 0xc01a0011; -pub const SMB_NTSTATUS_LOG_CONTAINER_LIMIT_EXCEEDED: u32 = 0xc01a0012; -pub const SMB_NTSTATUS_LOG_START_OF_LOG: u32 = 0xc01a0013; -pub const SMB_NTSTATUS_LOG_POLICY_ALREADY_INSTALLED: u32 = 0xc01a0014; -pub const SMB_NTSTATUS_LOG_POLICY_NOT_INSTALLED: u32 = 0xc01a0015; -pub const SMB_NTSTATUS_LOG_POLICY_INVALID: u32 = 0xc01a0016; -pub const SMB_NTSTATUS_LOG_POLICY_CONFLICT: u32 = 0xc01a0017; -pub const SMB_NTSTATUS_LOG_PINNED_ARCHIVE_TAIL: u32 = 0xc01a0018; -pub const SMB_NTSTATUS_LOG_RECORD_NONEXISTENT: u32 = 0xc01a0019; -pub const SMB_NTSTATUS_LOG_RECORDS_RESERVED_INVALID: u32 = 0xc01a001a; -pub const SMB_NTSTATUS_LOG_SPACE_RESERVED_INVALID: u32 = 0xc01a001b; -pub const SMB_NTSTATUS_LOG_TAIL_INVALID: u32 = 0xc01a001c; -pub const SMB_NTSTATUS_LOG_FULL: u32 = 0xc01a001d; -pub const SMB_NTSTATUS_LOG_MULTIPLEXED: u32 = 0xc01a001e; -pub const SMB_NTSTATUS_LOG_DEDICATED: u32 = 0xc01a001f; -pub const SMB_NTSTATUS_LOG_ARCHIVE_NOT_IN_PROGRESS: u32 = 0xc01a0020; -pub const SMB_NTSTATUS_LOG_ARCHIVE_IN_PROGRESS: u32 = 0xc01a0021; -pub const SMB_NTSTATUS_LOG_EPHEMERAL: u32 = 0xc01a0022; -pub const SMB_NTSTATUS_LOG_NOT_ENOUGH_CONTAINERS: u32 = 0xc01a0023; -pub const SMB_NTSTATUS_LOG_CLIENT_ALREADY_REGISTERED: u32 = 0xc01a0024; -pub const SMB_NTSTATUS_LOG_CLIENT_NOT_REGISTERED: u32 = 0xc01a0025; -pub const SMB_NTSTATUS_LOG_FULL_HANDLER_IN_PROGRESS: u32 = 0xc01a0026; -pub const SMB_NTSTATUS_LOG_CONTAINER_READ_FAILED: u32 = 0xc01a0027; -pub const SMB_NTSTATUS_LOG_CONTAINER_WRITE_FAILED: u32 = 0xc01a0028; -pub const SMB_NTSTATUS_LOG_CONTAINER_OPEN_FAILED: u32 = 0xc01a0029; -pub const SMB_NTSTATUS_LOG_CONTAINER_STATE_INVALID: u32 = 0xc01a002a; -pub const SMB_NTSTATUS_LOG_STATE_INVALID: u32 = 0xc01a002b; -pub const SMB_NTSTATUS_LOG_PINNED: u32 = 0xc01a002c; -pub const SMB_NTSTATUS_LOG_METADATA_FLUSH_FAILED: u32 = 0xc01a002d; -pub const SMB_NTSTATUS_LOG_INCONSISTENT_SECURITY: u32 = 0xc01a002e; -pub const SMB_NTSTATUS_LOG_APPENDED_FLUSH_FAILED: u32 = 0xc01a002f; -pub const SMB_NTSTATUS_LOG_PINNED_RESERVATION: u32 = 0xc01a0030; -pub const SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD: u32 = 0xc01b00ea; -pub const SMB_NTSTATUS_FLT_NO_HANDLER_DEFINED: u32 = 0xc01c0001; -pub const SMB_NTSTATUS_FLT_CONTEXT_ALREADY_DEFINED: u32 = 0xc01c0002; -pub const SMB_NTSTATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST: u32 = 0xc01c0003; -pub const SMB_NTSTATUS_FLT_DISALLOW_FAST_IO: u32 = 0xc01c0004; -pub const SMB_NTSTATUS_FLT_INVALID_NAME_REQUEST: u32 = 0xc01c0005; -pub const SMB_NTSTATUS_FLT_NOT_SAFE_TO_POST_OPERATION: u32 = 0xc01c0006; -pub const SMB_NTSTATUS_FLT_NOT_INITIALIZED: u32 = 0xc01c0007; -pub const SMB_NTSTATUS_FLT_FILTER_NOT_READY: u32 = 0xc01c0008; -pub const SMB_NTSTATUS_FLT_POST_OPERATION_CLEANUP: u32 = 0xc01c0009; -pub const SMB_NTSTATUS_FLT_INTERNAL_ERROR: u32 = 0xc01c000a; -pub const SMB_NTSTATUS_FLT_DELETING_OBJECT: u32 = 0xc01c000b; -pub const SMB_NTSTATUS_FLT_MUST_BE_NONPAGED_POOL: u32 = 0xc01c000c; -pub const SMB_NTSTATUS_FLT_DUPLICATE_ENTRY: u32 = 0xc01c000d; -pub const SMB_NTSTATUS_FLT_CBDQ_DISABLED: u32 = 0xc01c000e; -pub const SMB_NTSTATUS_FLT_DO_NOT_ATTACH: u32 = 0xc01c000f; -pub const SMB_NTSTATUS_FLT_DO_NOT_DETACH: u32 = 0xc01c0010; -pub const SMB_NTSTATUS_FLT_INSTANCE_ALTITUDE_COLLISION: u32 = 0xc01c0011; -pub const SMB_NTSTATUS_FLT_INSTANCE_NAME_COLLISION: u32 = 0xc01c0012; -pub const SMB_NTSTATUS_FLT_FILTER_NOT_FOUND: u32 = 0xc01c0013; -pub const SMB_NTSTATUS_FLT_VOLUME_NOT_FOUND: u32 = 0xc01c0014; -pub const SMB_NTSTATUS_FLT_INSTANCE_NOT_FOUND: u32 = 0xc01c0015; -pub const SMB_NTSTATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND: u32 = 0xc01c0016; -pub const SMB_NTSTATUS_FLT_INVALID_CONTEXT_REGISTRATION: u32 = 0xc01c0017; -pub const SMB_NTSTATUS_FLT_NAME_CACHE_MISS: u32 = 0xc01c0018; -pub const SMB_NTSTATUS_FLT_NO_DEVICE_OBJECT: u32 = 0xc01c0019; -pub const SMB_NTSTATUS_FLT_VOLUME_ALREADY_MOUNTED: u32 = 0xc01c001a; -pub const SMB_NTSTATUS_FLT_ALREADY_ENLISTED: u32 = 0xc01c001b; -pub const SMB_NTSTATUS_FLT_CONTEXT_ALREADY_LINKED: u32 = 0xc01c001c; -pub const SMB_NTSTATUS_FLT_NO_WAITER_FOR_REPLY: u32 = 0xc01c0020; -pub const SMB_NTSTATUS_MONITOR_NO_DESCRIPTOR: u32 = 0xc01d0001; -pub const SMB_NTSTATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: u32 = 0xc01d0002; -pub const SMB_NTSTATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: u32 = 0xc01d0003; -pub const SMB_NTSTATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK: u32 = 0xc01d0004; -pub const SMB_NTSTATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: u32 = 0xc01d0005; -pub const SMB_NTSTATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: u32 = 0xc01d0006; -pub const SMB_NTSTATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: u32 = 0xc01d0007; -pub const SMB_NTSTATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA: u32 = 0xc01d0008; -pub const SMB_NTSTATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK: u32 = 0xc01d0009; -pub const SMB_NTSTATUS_MONITOR_INVALID_MANUFACTURE_DATE: u32 = 0xc01d000a; -pub const SMB_NTSTATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: u32 = 0xc01e0000; -pub const SMB_NTSTATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: u32 = 0xc01e0001; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER: u32 = 0xc01e0002; -pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_WAS_RESET: u32 = 0xc01e0003; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_DRIVER_MODEL: u32 = 0xc01e0004; -pub const SMB_NTSTATUS_GRAPHICS_PRESENT_MODE_CHANGED: u32 = 0xc01e0005; -pub const SMB_NTSTATUS_GRAPHICS_PRESENT_OCCLUDED: u32 = 0xc01e0006; -pub const SMB_NTSTATUS_GRAPHICS_PRESENT_DENIED: u32 = 0xc01e0007; -pub const SMB_NTSTATUS_GRAPHICS_CANNOTCOLORCONVERT: u32 = 0xc01e0008; -pub const SMB_NTSTATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED: u32 = 0xc01e000b; -pub const SMB_NTSTATUS_GRAPHICS_PRESENT_UNOCCLUDED: u32 = 0xc01e000c; -pub const SMB_NTSTATUS_GRAPHICS_NO_VIDEO_MEMORY: u32 = 0xc01e0100; -pub const SMB_NTSTATUS_GRAPHICS_CANT_LOCK_MEMORY: u32 = 0xc01e0101; -pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_BUSY: u32 = 0xc01e0102; -pub const SMB_NTSTATUS_GRAPHICS_TOO_MANY_REFERENCES: u32 = 0xc01e0103; -pub const SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_LATER: u32 = 0xc01e0104; -pub const SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_NOW: u32 = 0xc01e0105; -pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_INVALID: u32 = 0xc01e0106; -pub const SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: u32 = 0xc01e0107; -pub const SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: u32 = 0xc01e0108; -pub const SMB_NTSTATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: u32 = 0xc01e0109; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_USAGE: u32 = 0xc01e0110; -pub const SMB_NTSTATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: u32 = 0xc01e0111; -pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_CLOSED: u32 = 0xc01e0112; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE: u32 = 0xc01e0113; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE: u32 = 0xc01e0114; -pub const SMB_NTSTATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE: u32 = 0xc01e0115; -pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_CONTENT_LOST: u32 = 0xc01e0116; -pub const SMB_NTSTATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: u32 = 0xc01e0200; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY: u32 = 0xc01e0300; -pub const SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: u32 = 0xc01e0301; -pub const SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: u32 = 0xc01e0302; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN: u32 = 0xc01e0303; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: u32 = 0xc01e0304; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: u32 = 0xc01e0305; -pub const SMB_NTSTATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: u32 = 0xc01e0306; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: u32 = 0xc01e0308; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET: u32 = 0xc01e0309; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_FREQUENCY: u32 = 0xc01e030a; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_ACTIVE_REGION: u32 = 0xc01e030b; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_TOTAL_REGION: u32 = 0xc01e030c; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: u32 = 0xc01e0310; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: u32 = 0xc01e0311; -pub const SMB_NTSTATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: u32 = 0xc01e0312; -pub const SMB_NTSTATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: u32 = 0xc01e0313; -pub const SMB_NTSTATUS_GRAPHICS_MODE_ALREADY_IN_MODESET: u32 = 0xc01e0314; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: u32 = 0xc01e0315; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: u32 = 0xc01e0316; -pub const SMB_NTSTATUS_GRAPHICS_SOURCE_ALREADY_IN_SET: u32 = 0xc01e0317; -pub const SMB_NTSTATUS_GRAPHICS_TARGET_ALREADY_IN_SET: u32 = 0xc01e0318; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: u32 = 0xc01e0319; -pub const SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: u32 = 0xc01e031a; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: u32 = 0xc01e031b; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: u32 = 0xc01e031c; -pub const SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: u32 = 0xc01e031d; -pub const SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: u32 = 0xc01e031f; -pub const SMB_NTSTATUS_GRAPHICS_STALE_MODESET: u32 = 0xc01e0320; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: u32 = 0xc01e0321; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: u32 = 0xc01e0322; -pub const SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: u32 = 0xc01e0323; -pub const SMB_NTSTATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: u32 = 0xc01e0324; -pub const SMB_NTSTATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: u32 = 0xc01e0325; -pub const SMB_NTSTATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: u32 = 0xc01e0326; -pub const SMB_NTSTATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY: u32 = 0xc01e0327; -pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: u32 = 0xc01e0328; -pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: u32 = 0xc01e0329; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET: u32 = 0xc01e032a; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR: u32 = 0xc01e032b; -pub const SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: u32 = 0xc01e032c; -pub const SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: u32 = 0xc01e032d; -pub const SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: u32 = 0xc01e032e; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: u32 = 0xc01e032f; -pub const SMB_NTSTATUS_GRAPHICS_RESOURCES_NOT_RELATED: u32 = 0xc01e0330; -pub const SMB_NTSTATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: u32 = 0xc01e0331; -pub const SMB_NTSTATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: u32 = 0xc01e0332; -pub const SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: u32 = 0xc01e0333; -pub const SMB_NTSTATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: u32 = 0xc01e0334; -pub const SMB_NTSTATUS_GRAPHICS_NO_VIDPNMGR: u32 = 0xc01e0335; -pub const SMB_NTSTATUS_GRAPHICS_NO_ACTIVE_VIDPN: u32 = 0xc01e0336; -pub const SMB_NTSTATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY: u32 = 0xc01e0337; -pub const SMB_NTSTATUS_GRAPHICS_MONITOR_NOT_CONNECTED: u32 = 0xc01e0338; -pub const SMB_NTSTATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: u32 = 0xc01e0339; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: u32 = 0xc01e033a; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE: u32 = 0xc01e033b; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_STRIDE: u32 = 0xc01e033c; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_PIXELFORMAT: u32 = 0xc01e033d; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_COLORBASIS: u32 = 0xc01e033e; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: u32 = 0xc01e033f; -pub const SMB_NTSTATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: u32 = 0xc01e0340; -pub const SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: u32 = 0xc01e0341; -pub const SMB_NTSTATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: u32 = 0xc01e0342; -pub const SMB_NTSTATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: u32 = 0xc01e0343; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: u32 = 0xc01e0344; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: u32 = 0xc01e0345; -pub const SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: u32 = 0xc01e0346; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_GAMMA_RAMP: u32 = 0xc01e0347; -pub const SMB_NTSTATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: u32 = 0xc01e0348; -pub const SMB_NTSTATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: u32 = 0xc01e0349; -pub const SMB_NTSTATUS_GRAPHICS_MODE_NOT_IN_MODESET: u32 = 0xc01e034a; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: u32 = 0xc01e034d; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE: u32 = 0xc01e034e; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE: u32 = 0xc01e034f; -pub const SMB_NTSTATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: u32 = 0xc01e0350; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_SCANLINE_ORDERING: u32 = 0xc01e0352; -pub const SMB_NTSTATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: u32 = 0xc01e0353; -pub const SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: u32 = 0xc01e0354; -pub const SMB_NTSTATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: u32 = 0xc01e0355; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: u32 = 0xc01e0356; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: u32 = 0xc01e0357; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: u32 = 0xc01e0358; -pub const SMB_NTSTATUS_GRAPHICS_MAX_NUM_PATHS_REACHED: u32 = 0xc01e0359; -pub const SMB_NTSTATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: u32 = 0xc01e035a; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_CLIENT_TYPE: u32 = 0xc01e035b; -pub const SMB_NTSTATUS_GRAPHICS_CLIENTVIDPN_NOT_SET: u32 = 0xc01e035c; -pub const SMB_NTSTATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: u32 = 0xc01e0400; -pub const SMB_NTSTATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: u32 = 0xc01e0401; -pub const SMB_NTSTATUS_GRAPHICS_NOT_A_LINKED_ADAPTER: u32 = 0xc01e0430; -pub const SMB_NTSTATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED: u32 = 0xc01e0431; -pub const SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: u32 = 0xc01e0432; -pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY: u32 = 0xc01e0433; -pub const SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_STARTED: u32 = 0xc01e0434; -pub const SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: u32 = 0xc01e0435; -pub const SMB_NTSTATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: u32 = 0xc01e0436; -pub const SMB_NTSTATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER: u32 = 0xc01e0438; -pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: u32 = 0xc01e043b; -pub const SMB_NTSTATUS_GRAPHICS_OPM_NOT_SUPPORTED: u32 = 0xc01e0500; -pub const SMB_NTSTATUS_GRAPHICS_COPP_NOT_SUPPORTED: u32 = 0xc01e0501; -pub const SMB_NTSTATUS_GRAPHICS_UAB_NOT_SUPPORTED: u32 = 0xc01e0502; -pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: u32 = 0xc01e0503; -pub const SMB_NTSTATUS_GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL: u32 = 0xc01e0504; -pub const SMB_NTSTATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST: u32 = 0xc01e0505; -pub const SMB_NTSTATUS_GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: u32 = 0xc01e0506; -pub const SMB_NTSTATUS_GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: u32 = 0xc01e0507; -pub const SMB_NTSTATUS_GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED: u32 = 0xc01e0508; -pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_POINTER: u32 = 0xc01e050a; -pub const SMB_NTSTATUS_GRAPHICS_OPM_INTERNAL_ERROR: u32 = 0xc01e050b; -pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_HANDLE: u32 = 0xc01e050c; -pub const SMB_NTSTATUS_GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: u32 = 0xc01e050d; -pub const SMB_NTSTATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: u32 = 0xc01e050e; -pub const SMB_NTSTATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED: u32 = 0xc01e050f; -pub const SMB_NTSTATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED: u32 = 0xc01e0510; -pub const SMB_NTSTATUS_GRAPHICS_PVP_HFS_FAILED: u32 = 0xc01e0511; -pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_SRM: u32 = 0xc01e0512; -pub const SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: u32 = 0xc01e0513; -pub const SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: u32 = 0xc01e0514; -pub const SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: u32 = 0xc01e0515; -pub const SMB_NTSTATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: u32 = 0xc01e0516; -pub const SMB_NTSTATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: u32 = 0xc01e0517; -pub const SMB_NTSTATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: u32 = 0xc01e0518; -pub const SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS: u32 = 0xc01e051a; -pub const SMB_NTSTATUS_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS: u32 = 0xc01e051b; -pub const SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: u32 = 0xc01e051c; -pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: u32 = 0xc01e051d; -pub const SMB_NTSTATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: u32 = 0xc01e051e; -pub const SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: u32 = 0xc01e051f; -pub const SMB_NTSTATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: u32 = 0xc01e0520; -pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: u32 = 0xc01e0521; -pub const SMB_NTSTATUS_GRAPHICS_I2C_NOT_SUPPORTED: u32 = 0xc01e0580; -pub const SMB_NTSTATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: u32 = 0xc01e0581; -pub const SMB_NTSTATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: u32 = 0xc01e0582; -pub const SMB_NTSTATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA: u32 = 0xc01e0583; -pub const SMB_NTSTATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: u32 = 0xc01e0584; -pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_DATA: u32 = 0xc01e0585; -pub const SMB_NTSTATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: u32 = 0xc01e0586; -pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING: u32 = 0xc01e0587; -pub const SMB_NTSTATUS_GRAPHICS_MCA_INTERNAL_ERROR: u32 = 0xc01e0588; -pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: u32 = 0xc01e0589; -pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: u32 = 0xc01e058a; -pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: u32 = 0xc01e058b; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: u32 = 0xc01e058c; -pub const SMB_NTSTATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS: u32 = 0xc01e058d; -pub const SMB_NTSTATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: u32 = 0xc01e05e0; -pub const SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: u32 = 0xc01e05e1; -pub const SMB_NTSTATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: u32 = 0xc01e05e2; -pub const SMB_NTSTATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: u32 = 0xc01e05e3; -pub const SMB_NTSTATUS_GRAPHICS_INVALID_POINTER: u32 = 0xc01e05e4; -pub const SMB_NTSTATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: u32 = 0xc01e05e5; -pub const SMB_NTSTATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: u32 = 0xc01e05e6; -pub const SMB_NTSTATUS_GRAPHICS_INTERNAL_ERROR: u32 = 0xc01e05e7; -pub const SMB_NTSTATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: u32 = 0xc01e05e8; -pub const SMB_NTSTATUS_FVE_LOCKED_VOLUME: u32 = 0xc0210000; -pub const SMB_NTSTATUS_FVE_NOT_ENCRYPTED: u32 = 0xc0210001; -pub const SMB_NTSTATUS_FVE_BAD_INFORMATION: u32 = 0xc0210002; -pub const SMB_NTSTATUS_FVE_TOO_SMALL: u32 = 0xc0210003; -pub const SMB_NTSTATUS_FVE_FAILED_WRONG_FS: u32 = 0xc0210004; -pub const SMB_NTSTATUS_FVE_FAILED_BAD_FS: u32 = 0xc0210005; -pub const SMB_NTSTATUS_FVE_FS_NOT_EXTENDED: u32 = 0xc0210006; -pub const SMB_NTSTATUS_FVE_FS_MOUNTED: u32 = 0xc0210007; -pub const SMB_NTSTATUS_FVE_NO_LICENSE: u32 = 0xc0210008; -pub const SMB_NTSTATUS_FVE_ACTION_NOT_ALLOWED: u32 = 0xc0210009; -pub const SMB_NTSTATUS_FVE_BAD_DATA: u32 = 0xc021000a; -pub const SMB_NTSTATUS_FVE_VOLUME_NOT_BOUND: u32 = 0xc021000b; -pub const SMB_NTSTATUS_FVE_NOT_DATA_VOLUME: u32 = 0xc021000c; -pub const SMB_NTSTATUS_FVE_CONV_READ_ERROR: u32 = 0xc021000d; -pub const SMB_NTSTATUS_FVE_CONV_WRITE_ERROR: u32 = 0xc021000e; -pub const SMB_NTSTATUS_FVE_OVERLAPPED_UPDATE: u32 = 0xc021000f; -pub const SMB_NTSTATUS_FVE_FAILED_SECTOR_SIZE: u32 = 0xc0210010; -pub const SMB_NTSTATUS_FVE_FAILED_AUTHENTICATION: u32 = 0xc0210011; -pub const SMB_NTSTATUS_FVE_NOT_OS_VOLUME: u32 = 0xc0210012; -pub const SMB_NTSTATUS_FVE_KEYFILE_NOT_FOUND: u32 = 0xc0210013; -pub const SMB_NTSTATUS_FVE_KEYFILE_INVALID: u32 = 0xc0210014; -pub const SMB_NTSTATUS_FVE_KEYFILE_NO_VMK: u32 = 0xc0210015; -pub const SMB_NTSTATUS_FVE_TPM_DISABLED: u32 = 0xc0210016; -pub const SMB_NTSTATUS_FVE_TPM_SRK_AUTH_NOT_ZERO: u32 = 0xc0210017; -pub const SMB_NTSTATUS_FVE_TPM_INVALID_PCR: u32 = 0xc0210018; -pub const SMB_NTSTATUS_FVE_TPM_NO_VMK: u32 = 0xc0210019; -pub const SMB_NTSTATUS_FVE_PIN_INVALID: u32 = 0xc021001a; -pub const SMB_NTSTATUS_FVE_AUTH_INVALID_APPLICATION: u32 = 0xc021001b; -pub const SMB_NTSTATUS_FVE_AUTH_INVALID_CONFIG: u32 = 0xc021001c; -pub const SMB_NTSTATUS_FVE_DEBUGGER_ENABLED: u32 = 0xc021001d; -pub const SMB_NTSTATUS_FVE_DRY_RUN_FAILED: u32 = 0xc021001e; -pub const SMB_NTSTATUS_FVE_BAD_METADATA_POINTER: u32 = 0xc021001f; -pub const SMB_NTSTATUS_FVE_OLD_METADATA_COPY: u32 = 0xc0210020; -pub const SMB_NTSTATUS_FVE_REBOOT_REQUIRED: u32 = 0xc0210021; -pub const SMB_NTSTATUS_FVE_RAW_ACCESS: u32 = 0xc0210022; -pub const SMB_NTSTATUS_FVE_RAW_BLOCKED: u32 = 0xc0210023; -pub const SMB_NTSTATUS_FVE_NO_FEATURE_LICENSE: u32 = 0xc0210026; -pub const SMB_NTSTATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: u32 = 0xc0210027; -pub const SMB_NTSTATUS_FVE_CONV_RECOVERY_FAILED: u32 = 0xc0210028; -pub const SMB_NTSTATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG: u32 = 0xc0210029; -pub const SMB_NTSTATUS_FVE_VOLUME_TOO_SMALL: u32 = 0xc0210030; -pub const SMB_NTSTATUS_FWP_CALLOUT_NOT_FOUND: u32 = 0xc0220001; -pub const SMB_NTSTATUS_FWP_CONDITION_NOT_FOUND: u32 = 0xc0220002; -pub const SMB_NTSTATUS_FWP_FILTER_NOT_FOUND: u32 = 0xc0220003; -pub const SMB_NTSTATUS_FWP_LAYER_NOT_FOUND: u32 = 0xc0220004; -pub const SMB_NTSTATUS_FWP_PROVIDER_NOT_FOUND: u32 = 0xc0220005; -pub const SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND: u32 = 0xc0220006; -pub const SMB_NTSTATUS_FWP_SUBLAYER_NOT_FOUND: u32 = 0xc0220007; -pub const SMB_NTSTATUS_FWP_NOT_FOUND: u32 = 0xc0220008; -pub const SMB_NTSTATUS_FWP_ALREADY_EXISTS: u32 = 0xc0220009; -pub const SMB_NTSTATUS_FWP_IN_USE: u32 = 0xc022000a; -pub const SMB_NTSTATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS: u32 = 0xc022000b; -pub const SMB_NTSTATUS_FWP_WRONG_SESSION: u32 = 0xc022000c; -pub const SMB_NTSTATUS_FWP_NO_TXN_IN_PROGRESS: u32 = 0xc022000d; -pub const SMB_NTSTATUS_FWP_TXN_IN_PROGRESS: u32 = 0xc022000e; -pub const SMB_NTSTATUS_FWP_TXN_ABORTED: u32 = 0xc022000f; -pub const SMB_NTSTATUS_FWP_SESSION_ABORTED: u32 = 0xc0220010; -pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_TXN: u32 = 0xc0220011; -pub const SMB_NTSTATUS_FWP_TIMEOUT: u32 = 0xc0220012; -pub const SMB_NTSTATUS_FWP_NET_EVENTS_DISABLED: u32 = 0xc0220013; -pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_LAYER: u32 = 0xc0220014; -pub const SMB_NTSTATUS_FWP_KM_CLIENTS_ONLY: u32 = 0xc0220015; -pub const SMB_NTSTATUS_FWP_LIFETIME_MISMATCH: u32 = 0xc0220016; -pub const SMB_NTSTATUS_FWP_BUILTIN_OBJECT: u32 = 0xc0220017; -pub const SMB_NTSTATUS_FWP_TOO_MANY_BOOTTIME_FILTERS: u32 = 0xc0220018; -pub const SMB_NTSTATUS_FWP_NOTIFICATION_DROPPED: u32 = 0xc0220019; -pub const SMB_NTSTATUS_FWP_TRAFFIC_MISMATCH: u32 = 0xc022001a; -pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_SA_STATE: u32 = 0xc022001b; -pub const SMB_NTSTATUS_FWP_NULL_POINTER: u32 = 0xc022001c; -pub const SMB_NTSTATUS_FWP_INVALID_ENUMERATOR: u32 = 0xc022001d; -pub const SMB_NTSTATUS_FWP_INVALID_FLAGS: u32 = 0xc022001e; -pub const SMB_NTSTATUS_FWP_INVALID_NET_MASK: u32 = 0xc022001f; -pub const SMB_NTSTATUS_FWP_INVALID_RANGE: u32 = 0xc0220020; -pub const SMB_NTSTATUS_FWP_INVALID_INTERVAL: u32 = 0xc0220021; -pub const SMB_NTSTATUS_FWP_ZERO_LENGTH_ARRAY: u32 = 0xc0220022; -pub const SMB_NTSTATUS_FWP_NULL_DISPLAY_NAME: u32 = 0xc0220023; -pub const SMB_NTSTATUS_FWP_INVALID_ACTION_TYPE: u32 = 0xc0220024; -pub const SMB_NTSTATUS_FWP_INVALID_WEIGHT: u32 = 0xc0220025; -pub const SMB_NTSTATUS_FWP_MATCH_TYPE_MISMATCH: u32 = 0xc0220026; -pub const SMB_NTSTATUS_FWP_TYPE_MISMATCH: u32 = 0xc0220027; -pub const SMB_NTSTATUS_FWP_OUT_OF_BOUNDS: u32 = 0xc0220028; -pub const SMB_NTSTATUS_FWP_RESERVED: u32 = 0xc0220029; -pub const SMB_NTSTATUS_FWP_DUPLICATE_CONDITION: u32 = 0xc022002a; -pub const SMB_NTSTATUS_FWP_DUPLICATE_KEYMOD: u32 = 0xc022002b; -pub const SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER: u32 = 0xc022002c; -pub const SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER: u32 = 0xc022002d; -pub const SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER: u32 = 0xc022002e; -pub const SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: u32 = 0xc022002f; -pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_METHOD: u32 = 0xc0220030; -pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_DH_GROUP: u32 = 0xc0220031; -pub const SMB_NTSTATUS_FWP_EM_NOT_SUPPORTED: u32 = 0xc0220032; -pub const SMB_NTSTATUS_FWP_NEVER_MATCH: u32 = 0xc0220033; -pub const SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_MISMATCH: u32 = 0xc0220034; -pub const SMB_NTSTATUS_FWP_INVALID_PARAMETER: u32 = 0xc0220035; -pub const SMB_NTSTATUS_FWP_TOO_MANY_SUBLAYERS: u32 = 0xc0220036; -pub const SMB_NTSTATUS_FWP_CALLOUT_NOTIFICATION_FAILED: u32 = 0xc0220037; -pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_CONFIG: u32 = 0xc0220038; -pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_CIPHER_CONFIG: u32 = 0xc0220039; -pub const SMB_NTSTATUS_FWP_DUPLICATE_AUTH_METHOD: u32 = 0xc022003c; -pub const SMB_NTSTATUS_FWP_TCPIP_NOT_READY: u32 = 0xc0220100; -pub const SMB_NTSTATUS_FWP_INJECT_HANDLE_CLOSING: u32 = 0xc0220101; -pub const SMB_NTSTATUS_FWP_INJECT_HANDLE_STALE: u32 = 0xc0220102; -pub const SMB_NTSTATUS_FWP_CANNOT_PEND: u32 = 0xc0220103; -pub const SMB_NTSTATUS_NDIS_CLOSING: u32 = 0xc0230002; -pub const SMB_NTSTATUS_NDIS_BAD_VERSION: u32 = 0xc0230004; -pub const SMB_NTSTATUS_NDIS_BAD_CHARACTERISTICS: u32 = 0xc0230005; -pub const SMB_NTSTATUS_NDIS_ADAPTER_NOT_FOUND: u32 = 0xc0230006; -pub const SMB_NTSTATUS_NDIS_OPEN_FAILED: u32 = 0xc0230007; -pub const SMB_NTSTATUS_NDIS_DEVICE_FAILED: u32 = 0xc0230008; -pub const SMB_NTSTATUS_NDIS_MULTICAST_FULL: u32 = 0xc0230009; -pub const SMB_NTSTATUS_NDIS_MULTICAST_EXISTS: u32 = 0xc023000a; -pub const SMB_NTSTATUS_NDIS_MULTICAST_NOT_FOUND: u32 = 0xc023000b; -pub const SMB_NTSTATUS_NDIS_REQUEST_ABORTED: u32 = 0xc023000c; -pub const SMB_NTSTATUS_NDIS_RESET_IN_PROGRESS: u32 = 0xc023000d; -pub const SMB_NTSTATUS_NDIS_INVALID_PACKET: u32 = 0xc023000f; -pub const SMB_NTSTATUS_NDIS_INVALID_DEVICE_REQUEST: u32 = 0xc0230010; -pub const SMB_NTSTATUS_NDIS_ADAPTER_NOT_READY: u32 = 0xc0230011; -pub const SMB_NTSTATUS_NDIS_INVALID_LENGTH: u32 = 0xc0230014; -pub const SMB_NTSTATUS_NDIS_INVALID_DATA: u32 = 0xc0230015; -pub const SMB_NTSTATUS_NDIS_BUFFER_TOO_SHORT: u32 = 0xc0230016; -pub const SMB_NTSTATUS_NDIS_INVALID_OID: u32 = 0xc0230017; -pub const SMB_NTSTATUS_NDIS_ADAPTER_REMOVED: u32 = 0xc0230018; -pub const SMB_NTSTATUS_NDIS_UNSUPPORTED_MEDIA: u32 = 0xc0230019; -pub const SMB_NTSTATUS_NDIS_GROUP_ADDRESS_IN_USE: u32 = 0xc023001a; -pub const SMB_NTSTATUS_NDIS_FILE_NOT_FOUND: u32 = 0xc023001b; -pub const SMB_NTSTATUS_NDIS_ERROR_READING_FILE: u32 = 0xc023001c; -pub const SMB_NTSTATUS_NDIS_ALREADY_MAPPED: u32 = 0xc023001d; -pub const SMB_NTSTATUS_NDIS_RESOURCE_CONFLICT: u32 = 0xc023001e; -pub const SMB_NTSTATUS_NDIS_MEDIA_DISCONNECTED: u32 = 0xc023001f; -pub const SMB_NTSTATUS_NDIS_INVALID_ADDRESS: u32 = 0xc0230022; -pub const SMB_NTSTATUS_NDIS_PAUSED: u32 = 0xc023002a; -pub const SMB_NTSTATUS_NDIS_INTERFACE_NOT_FOUND: u32 = 0xc023002b; -pub const SMB_NTSTATUS_NDIS_UNSUPPORTED_REVISION: u32 = 0xc023002c; -pub const SMB_NTSTATUS_NDIS_INVALID_PORT: u32 = 0xc023002d; -pub const SMB_NTSTATUS_NDIS_INVALID_PORT_STATE: u32 = 0xc023002e; -pub const SMB_NTSTATUS_NDIS_LOW_POWER_STATE: u32 = 0xc023002f; -pub const SMB_NTSTATUS_NDIS_NOT_SUPPORTED: u32 = 0xc02300bb; -pub const SMB_NTSTATUS_NDIS_OFFLOAD_POLICY: u32 = 0xc023100f; -pub const SMB_NTSTATUS_NDIS_OFFLOAD_CONNECTION_REJECTED: u32 = 0xc0231012; -pub const SMB_NTSTATUS_NDIS_OFFLOAD_PATH_REJECTED: u32 = 0xc0231013; -pub const SMB_NTSTATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED: u32 = 0xc0232000; -pub const SMB_NTSTATUS_NDIS_DOT11_MEDIA_IN_USE: u32 = 0xc0232001; -pub const SMB_NTSTATUS_NDIS_DOT11_POWER_STATE_INVALID: u32 = 0xc0232002; -pub const SMB_NTSTATUS_NDIS_PM_WOL_PATTERN_LIST_FULL: u32 = 0xc0232003; -pub const SMB_NTSTATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: u32 = 0xc0232004; -pub const SMB_NTSTATUS_IPSEC_BAD_SPI: u32 = 0xc0360001; -pub const SMB_NTSTATUS_IPSEC_SA_LIFETIME_EXPIRED: u32 = 0xc0360002; -pub const SMB_NTSTATUS_IPSEC_WRONG_SA: u32 = 0xc0360003; -pub const SMB_NTSTATUS_IPSEC_REPLAY_CHECK_FAILED: u32 = 0xc0360004; -pub const SMB_NTSTATUS_IPSEC_INVALID_PACKET: u32 = 0xc0360005; -pub const SMB_NTSTATUS_IPSEC_INTEGRITY_CHECK_FAILED: u32 = 0xc0360006; -pub const SMB_NTSTATUS_IPSEC_CLEAR_TEXT_DROP: u32 = 0xc0360007; -pub const SMB_NTSTATUS_IPSEC_AUTH_FIREWALL_DROP: u32 = 0xc0360008; -pub const SMB_NTSTATUS_IPSEC_THROTTLE_DROP: u32 = 0xc0360009; -pub const SMB_NTSTATUS_IPSEC_DOSP_BLOCK: u32 = 0xc0368000; -pub const SMB_NTSTATUS_IPSEC_DOSP_RECEIVED_MULTICAST: u32 = 0xc0368001; -pub const SMB_NTSTATUS_IPSEC_DOSP_INVALID_PACKET: u32 = 0xc0368002; -pub const SMB_NTSTATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED: u32 = 0xc0368003; -pub const SMB_NTSTATUS_IPSEC_DOSP_MAX_ENTRIES: u32 = 0xc0368004; -pub const SMB_NTSTATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: u32 = 0xc0368005; -pub const SMB_NTSTATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: u32 = 0xc0368006; -pub const SMB_NTSTATUS_VOLMGR_MIRROR_NOT_SUPPORTED: u32 = 0xc038005b; -pub const SMB_NTSTATUS_VOLMGR_RAID5_NOT_SUPPORTED: u32 = 0xc038005c; -pub const SMB_NTSTATUS_VIRTDISK_PROVIDER_NOT_FOUND: u32 = 0xc03a0014; -pub const SMB_NTSTATUS_VIRTDISK_NOT_VIRTUAL_DISK: u32 = 0xc03a0015; -pub const SMB_NTSTATUS_VHD_PARENT_VHD_ACCESS_DENIED: u32 = 0xc03a0016; -pub const SMB_NTSTATUS_VHD_CHILD_PARENT_SIZE_MISMATCH: u32 = 0xc03a0017; -pub const SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: u32 = 0xc03a0018; -pub const SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: u32 = 0xc03a0019; +pub const SMB_NTSTATUS_SUCCESS: u32 = 0x00000000; +pub const SMB_NTSTATUS_WAIT_1: u32 = 0x00000001; +pub const SMB_NTSTATUS_WAIT_2: u32 = 0x00000002; +pub const SMB_NTSTATUS_WAIT_3: u32 = 0x00000003; +pub const SMB_NTSTATUS_WAIT_63: u32 = 0x0000003f; +pub const SMB_NTSTATUS_ABANDONED: u32 = 0x00000080; +pub const SMB_NTSTATUS_ABANDONED_WAIT_63: u32 = 0x000000bf; +pub const SMB_NTSTATUS_USER_APC: u32 = 0x000000c0; +pub const SMB_NTSTATUS_ALERTED: u32 = 0x00000101; +pub const SMB_NTSTATUS_TIMEOUT: u32 = 0x00000102; +pub const SMB_NTSTATUS_PENDING: u32 = 0x00000103; +pub const SMB_NTSTATUS_REPARSE: u32 = 0x00000104; +pub const SMB_NTSTATUS_MORE_ENTRIES: u32 = 0x00000105; +pub const SMB_NTSTATUS_NOT_ALL_ASSIGNED: u32 = 0x00000106; +pub const SMB_NTSTATUS_SOME_NOT_MAPPED: u32 = 0x00000107; +pub const SMB_NTSTATUS_OPLOCK_BREAK_IN_PROGRESS: u32 = 0x00000108; +pub const SMB_NTSTATUS_VOLUME_MOUNTED: u32 = 0x00000109; +pub const SMB_NTSTATUS_RXACT_COMMITTED: u32 = 0x0000010a; +pub const SMB_NTSTATUS_NOTIFY_CLEANUP: u32 = 0x0000010b; +pub const SMB_NTSTATUS_NOTIFY_ENUM_DIR: u32 = 0x0000010c; +pub const SMB_NTSTATUS_NO_QUOTAS_FOR_ACCOUNT: u32 = 0x0000010d; +pub const SMB_NTSTATUS_PRIMARY_TRANSPORT_CONNECT_FAILED: u32 = 0x0000010e; +pub const SMB_NTSTATUS_PAGE_FAULT_TRANSITION: u32 = 0x00000110; +pub const SMB_NTSTATUS_PAGE_FAULT_DEMAND_ZERO: u32 = 0x00000111; +pub const SMB_NTSTATUS_PAGE_FAULT_COPY_ON_WRITE: u32 = 0x00000112; +pub const SMB_NTSTATUS_PAGE_FAULT_GUARD_PAGE: u32 = 0x00000113; +pub const SMB_NTSTATUS_PAGE_FAULT_PAGING_FILE: u32 = 0x00000114; +pub const SMB_NTSTATUS_CACHE_PAGE_LOCKED: u32 = 0x00000115; +pub const SMB_NTSTATUS_CRASH_DUMP: u32 = 0x00000116; +pub const SMB_NTSTATUS_BUFFER_ALL_ZEROS: u32 = 0x00000117; +pub const SMB_NTSTATUS_REPARSE_OBJECT: u32 = 0x00000118; +pub const SMB_NTSTATUS_RESOURCE_REQUIREMENTS_CHANGED: u32 = 0x00000119; +pub const SMB_NTSTATUS_TRANSLATION_COMPLETE: u32 = 0x00000120; +pub const SMB_NTSTATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY: u32 = 0x00000121; +pub const SMB_NTSTATUS_NOTHING_TO_TERMINATE: u32 = 0x00000122; +pub const SMB_NTSTATUS_PROCESS_NOT_IN_JOB: u32 = 0x00000123; +pub const SMB_NTSTATUS_PROCESS_IN_JOB: u32 = 0x00000124; +pub const SMB_NTSTATUS_VOLSNAP_HIBERNATE_READY: u32 = 0x00000125; +pub const SMB_NTSTATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY: u32 = 0x00000126; +pub const SMB_NTSTATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED: u32 = 0x00000127; +pub const SMB_NTSTATUS_INTERRUPT_STILL_CONNECTED: u32 = 0x00000128; +pub const SMB_NTSTATUS_PROCESS_CLONED: u32 = 0x00000129; +pub const SMB_NTSTATUS_FILE_LOCKED_WITH_ONLY_READERS: u32 = 0x0000012a; +pub const SMB_NTSTATUS_FILE_LOCKED_WITH_WRITERS: u32 = 0x0000012b; +pub const SMB_NTSTATUS_RESOURCEMANAGER_READ_ONLY: u32 = 0x00000202; +pub const SMB_NTSTATUS_WAIT_FOR_OPLOCK: u32 = 0x00000367; +pub const SMB_NTDBG_EXCEPTION_HANDLED: u32 = 0x00010001; +pub const SMB_NTDBG_CONTINUE: u32 = 0x00010002; +pub const SMB_NTSTATUS_FLT_IO_COMPLETE: u32 = 0x001c0001; +pub const SMB_NTSTATUS_FILE_NOT_AVAILABLE: u32 = 0xc0000467; +pub const SMB_NTSTATUS_SHARE_UNAVAILABLE: u32 = 0xc0000480; +pub const SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_AFFINITY: u32 = 0xc0000721; +pub const SMB_NTSTATUS_OBJECT_NAME_EXISTS: u32 = 0x40000000; +pub const SMB_NTSTATUS_THREAD_WAS_SUSPENDED: u32 = 0x40000001; +pub const SMB_NTSTATUS_WORKING_SET_LIMIT_RANGE: u32 = 0x40000002; +pub const SMB_NTSTATUS_IMAGE_NOT_AT_BASE: u32 = 0x40000003; +pub const SMB_NTSTATUS_RXACT_STATE_CREATED: u32 = 0x40000004; +pub const SMB_NTSTATUS_SEGMENT_NOTIFICATION: u32 = 0x40000005; +pub const SMB_NTSTATUS_LOCAL_USER_SESSION_KEY: u32 = 0x40000006; +pub const SMB_NTSTATUS_BAD_CURRENT_DIRECTORY: u32 = 0x40000007; +pub const SMB_NTSTATUS_SERIAL_MORE_WRITES: u32 = 0x40000008; +pub const SMB_NTSTATUS_REGISTRY_RECOVERED: u32 = 0x40000009; +pub const SMB_NTSTATUS_FT_READ_RECOVERY_FROM_BACKUP: u32 = 0x4000000a; +pub const SMB_NTSTATUS_FT_WRITE_RECOVERY: u32 = 0x4000000b; +pub const SMB_NTSTATUS_SERIAL_COUNTER_TIMEOUT: u32 = 0x4000000c; +pub const SMB_NTSTATUS_NULL_LM_PASSWORD: u32 = 0x4000000d; +pub const SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH: u32 = 0x4000000e; +pub const SMB_NTSTATUS_RECEIVE_PARTIAL: u32 = 0x4000000f; +pub const SMB_NTSTATUS_RECEIVE_EXPEDITED: u32 = 0x40000010; +pub const SMB_NTSTATUS_RECEIVE_PARTIAL_EXPEDITED: u32 = 0x40000011; +pub const SMB_NTSTATUS_EVENT_DONE: u32 = 0x40000012; +pub const SMB_NTSTATUS_EVENT_PENDING: u32 = 0x40000013; +pub const SMB_NTSTATUS_CHECKING_FILE_SYSTEM: u32 = 0x40000014; +pub const SMB_NTSTATUS_FATAL_APP_EXIT: u32 = 0x40000015; +pub const SMB_NTSTATUS_PREDEFINED_HANDLE: u32 = 0x40000016; +pub const SMB_NTSTATUS_WAS_UNLOCKED: u32 = 0x40000017; +pub const SMB_NTSTATUS_SERVICE_NOTIFICATION: u32 = 0x40000018; +pub const SMB_NTSTATUS_WAS_LOCKED: u32 = 0x40000019; +pub const SMB_NTSTATUS_LOG_HARD_ERROR: u32 = 0x4000001a; +pub const SMB_NTSTATUS_ALREADY_WIN32: u32 = 0x4000001b; +pub const SMB_NTSTATUS_WX86_UNSIMULATE: u32 = 0x4000001c; +pub const SMB_NTSTATUS_WX86_CONTINUE: u32 = 0x4000001d; +pub const SMB_NTSTATUS_WX86_SINGLE_STEP: u32 = 0x4000001e; +pub const SMB_NTSTATUS_WX86_BREAKPOINT: u32 = 0x4000001f; +pub const SMB_NTSTATUS_WX86_EXCEPTION_CONTINUE: u32 = 0x40000020; +pub const SMB_NTSTATUS_WX86_EXCEPTION_LASTCHANCE: u32 = 0x40000021; +pub const SMB_NTSTATUS_WX86_EXCEPTION_CHAIN: u32 = 0x40000022; +pub const SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE: u32 = 0x40000023; +pub const SMB_NTSTATUS_NO_YIELD_PERFORMED: u32 = 0x40000024; +pub const SMB_NTSTATUS_TIMER_RESUME_IGNORED: u32 = 0x40000025; +pub const SMB_NTSTATUS_ARBITRATION_UNHANDLED: u32 = 0x40000026; +pub const SMB_NTSTATUS_CARDBUS_NOT_SUPPORTED: u32 = 0x40000027; +pub const SMB_NTSTATUS_WX86_CREATEWX86TIB: u32 = 0x40000028; +pub const SMB_NTSTATUS_MP_PROCESSOR_MISMATCH: u32 = 0x40000029; +pub const SMB_NTSTATUS_HIBERNATED: u32 = 0x4000002a; +pub const SMB_NTSTATUS_RESUME_HIBERNATION: u32 = 0x4000002b; +pub const SMB_NTSTATUS_FIRMWARE_UPDATED: u32 = 0x4000002c; +pub const SMB_NTSTATUS_DRIVERS_LEAKING_LOCKED_PAGES: u32 = 0x4000002d; +pub const SMB_NTSTATUS_MESSAGE_RETRIEVED: u32 = 0x4000002e; +pub const SMB_NTSTATUS_SYSTEM_POWERSTATE_TRANSITION: u32 = 0x4000002f; +pub const SMB_NTSTATUS_ALPC_CHECK_COMPLETION_LIST: u32 = 0x40000030; +pub const SMB_NTSTATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: u32 = 0x40000031; +pub const SMB_NTSTATUS_ACCESS_AUDIT_BY_POLICY: u32 = 0x40000032; +pub const SMB_NTSTATUS_ABANDON_HIBERFILE: u32 = 0x40000033; +pub const SMB_NTSTATUS_BIZRULES_NOT_ENABLED: u32 = 0x40000034; +pub const SMB_NTSTATUS_WAKE_SYSTEM: u32 = 0x40000294; +pub const SMB_NTSTATUS_DS_SHUTTING_DOWN: u32 = 0x40000370; +pub const SMB_NTDBG_REPLY_LATER: u32 = 0x40010001; +pub const SMB_NTDBG_UNABLE_TO_PROVIDE_HANDLE: u32 = 0x40010002; +pub const SMB_NTDBG_TERMINATE_THREAD: u32 = 0x40010003; +pub const SMB_NTDBG_TERMINATE_PROCESS: u32 = 0x40010004; +pub const SMB_NTDBG_CONTROL_C: u32 = 0x40010005; +pub const SMB_NTDBG_PRINTEXCEPTION_C: u32 = 0x40010006; +pub const SMB_NTDBG_RIPEXCEPTION: u32 = 0x40010007; +pub const SMB_NTDBG_CONTROL_BREAK: u32 = 0x40010008; +pub const SMB_NTDBG_COMMAND_EXCEPTION: u32 = 0x40010009; +pub const SMB_NTRPC_NT_UUID_LOCAL_ONLY: u32 = 0x40020056; +pub const SMB_NTRPC_NT_SEND_INCOMPLETE: u32 = 0x400200af; +pub const SMB_NTSTATUS_CTX_CDM_CONNECT: u32 = 0x400a0004; +pub const SMB_NTSTATUS_CTX_CDM_DISCONNECT: u32 = 0x400a0005; +pub const SMB_NTSTATUS_SXS_RELEASE_ACTIVATION_CONTEXT: u32 = 0x4015000d; +pub const SMB_NTSTATUS_RECOVERY_NOT_NEEDED: u32 = 0x40190034; +pub const SMB_NTSTATUS_RM_ALREADY_STARTED: u32 = 0x40190035; +pub const SMB_NTSTATUS_LOG_NO_RESTART: u32 = 0x401a000c; +pub const SMB_NTSTATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST: u32 = 0x401b00ec; +pub const SMB_NTSTATUS_GRAPHICS_PARTIAL_DATA_POPULATED: u32 = 0x401e000a; +pub const SMB_NTSTATUS_GRAPHICS_DRIVER_MISMATCH: u32 = 0x401e0117; +pub const SMB_NTSTATUS_GRAPHICS_MODE_NOT_PINNED: u32 = 0x401e0307; +pub const SMB_NTSTATUS_GRAPHICS_NO_PREFERRED_MODE: u32 = 0x401e031e; +pub const SMB_NTSTATUS_GRAPHICS_DATASET_IS_EMPTY: u32 = 0x401e034b; +pub const SMB_NTSTATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: u32 = 0x401e034c; +pub const SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: u32 = 0x401e0351; +pub const SMB_NTSTATUS_GRAPHICS_UNKNOWN_CHILD_STATUS: u32 = 0x401e042f; +pub const SMB_NTSTATUS_GRAPHICS_LEADLINK_START_DEFERRED: u32 = 0x401e0437; +pub const SMB_NTSTATUS_GRAPHICS_POLLING_TOO_FREQUENTLY: u32 = 0x401e0439; +pub const SMB_NTSTATUS_GRAPHICS_START_DEFERRED: u32 = 0x401e043a; +pub const SMB_NTSTATUS_NDIS_INDICATION_REQUIRED: u32 = 0x40230001; +pub const SMB_NTSTATUS_GUARD_PAGE_VIOLATION: u32 = 0x80000001; +pub const SMB_NTSTATUS_DATATYPE_MISALIGNMENT: u32 = 0x80000002; +pub const SMB_NTSTATUS_BREAKPOINT: u32 = 0x80000003; +pub const SMB_NTSTATUS_SINGLE_STEP: u32 = 0x80000004; +pub const SMB_NTSTATUS_BUFFER_OVERFLOW: u32 = 0x80000005; +pub const SMB_NTSTATUS_NO_MORE_FILES: u32 = 0x80000006; +pub const SMB_NTSTATUS_WAKE_SYSTEM_DEBUGGER: u32 = 0x80000007; +pub const SMB_NTSTATUS_HANDLES_CLOSED: u32 = 0x8000000a; +pub const SMB_NTSTATUS_NO_INHERITANCE: u32 = 0x8000000b; +pub const SMB_NTSTATUS_GUID_SUBSTITUTION_MADE: u32 = 0x8000000c; +pub const SMB_NTSTATUS_PARTIAL_COPY: u32 = 0x8000000d; +pub const SMB_NTSTATUS_DEVICE_PAPER_EMPTY: u32 = 0x8000000e; +pub const SMB_NTSTATUS_DEVICE_POWERED_OFF: u32 = 0x8000000f; +pub const SMB_NTSTATUS_DEVICE_OFF_LINE: u32 = 0x80000010; +pub const SMB_NTSTATUS_DEVICE_BUSY: u32 = 0x80000011; +pub const SMB_NTSTATUS_NO_MORE_EAS: u32 = 0x80000012; +pub const SMB_NTSTATUS_INVALID_EA_NAME: u32 = 0x80000013; +pub const SMB_NTSTATUS_EA_LIST_INCONSISTENT: u32 = 0x80000014; +pub const SMB_NTSTATUS_INVALID_EA_FLAG: u32 = 0x80000015; +pub const SMB_NTSTATUS_VERIFY_REQUIRED: u32 = 0x80000016; +pub const SMB_NTSTATUS_EXTRANEOUS_INFORMATION: u32 = 0x80000017; +pub const SMB_NTSTATUS_RXACT_COMMIT_NECESSARY: u32 = 0x80000018; +pub const SMB_NTSTATUS_NO_MORE_ENTRIES: u32 = 0x8000001a; +pub const SMB_NTSTATUS_FILEMARK_DETECTED: u32 = 0x8000001b; +pub const SMB_NTSTATUS_MEDIA_CHANGED: u32 = 0x8000001c; +pub const SMB_NTSTATUS_BUS_RESET: u32 = 0x8000001d; +pub const SMB_NTSTATUS_END_OF_MEDIA: u32 = 0x8000001e; +pub const SMB_NTSTATUS_BEGINNING_OF_MEDIA: u32 = 0x8000001f; +pub const SMB_NTSTATUS_MEDIA_CHECK: u32 = 0x80000020; +pub const SMB_NTSTATUS_SETMARK_DETECTED: u32 = 0x80000021; +pub const SMB_NTSTATUS_NO_DATA_DETECTED: u32 = 0x80000022; +pub const SMB_NTSTATUS_REDIRECTOR_HAS_OPEN_HANDLES: u32 = 0x80000023; +pub const SMB_NTSTATUS_SERVER_HAS_OPEN_HANDLES: u32 = 0x80000024; +pub const SMB_NTSTATUS_ALREADY_DISCONNECTED: u32 = 0x80000025; +pub const SMB_NTSTATUS_LONGJUMP: u32 = 0x80000026; +pub const SMB_NTSTATUS_CLEANER_CARTRIDGE_INSTALLED: u32 = 0x80000027; +pub const SMB_NTSTATUS_PLUGPLAY_QUERY_VETOED: u32 = 0x80000028; +pub const SMB_NTSTATUS_UNWIND_CONSOLIDATE: u32 = 0x80000029; +pub const SMB_NTSTATUS_REGISTRY_HIVE_RECOVERED: u32 = 0x8000002a; +pub const SMB_NTSTATUS_DLL_MIGHT_BE_INSECURE: u32 = 0x8000002b; +pub const SMB_NTSTATUS_DLL_MIGHT_BE_INCOMPATIBLE: u32 = 0x8000002c; +pub const SMB_NTSTATUS_STOPPED_ON_SYMLINK: u32 = 0x8000002d; +pub const SMB_NTSTATUS_DEVICE_REQUIRES_CLEANING: u32 = 0x80000288; +pub const SMB_NTSTATUS_DEVICE_DOOR_OPEN: u32 = 0x80000289; +pub const SMB_NTSTATUS_DATA_LOST_REPAIR: u32 = 0x80000803; +pub const SMB_NTDBG_EXCEPTION_NOT_HANDLED: u32 = 0x80010001; +pub const SMB_NTSTATUS_CLUSTER_NODE_ALREADY_UP: u32 = 0x80130001; +pub const SMB_NTSTATUS_CLUSTER_NODE_ALREADY_DOWN: u32 = 0x80130002; +pub const SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_ONLINE: u32 = 0x80130003; +pub const SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_OFFLINE: u32 = 0x80130004; +pub const SMB_NTSTATUS_CLUSTER_NODE_ALREADY_MEMBER: u32 = 0x80130005; +pub const SMB_NTSTATUS_COULD_NOT_RESIZE_LOG: u32 = 0x80190009; +pub const SMB_NTSTATUS_NO_TXF_METADATA: u32 = 0x80190029; +pub const SMB_NTSTATUS_CANT_RECOVER_WITH_HANDLE_OPEN: u32 = 0x80190031; +pub const SMB_NTSTATUS_TXF_METADATA_ALREADY_PRESENT: u32 = 0x80190041; +pub const SMB_NTSTATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: u32 = 0x80190042; +pub const SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED: u32 = 0x801b00eb; +pub const SMB_NTSTATUS_FLT_BUFFER_TOO_SMALL: u32 = 0x801c0001; +pub const SMB_NTSTATUS_FVE_PARTIAL_METADATA: u32 = 0x80210001; +pub const SMB_NTSTATUS_FVE_TRANSIENT_STATE: u32 = 0x80210002; +pub const SMB_NTSTATUS_UNSUCCESSFUL: u32 = 0xc0000001; +pub const SMB_NTSTATUS_NOT_IMPLEMENTED: u32 = 0xc0000002; +pub const SMB_NTSTATUS_INVALID_INFO_CLASS: u32 = 0xc0000003; +pub const SMB_NTSTATUS_INFO_LENGTH_MISMATCH: u32 = 0xc0000004; +pub const SMB_NTSTATUS_ACCESS_VIOLATION: u32 = 0xc0000005; +pub const SMB_NTSTATUS_IN_PAGE_ERROR: u32 = 0xc0000006; +pub const SMB_NTSTATUS_PAGEFILE_QUOTA: u32 = 0xc0000007; +pub const SMB_NTSTATUS_INVALID_HANDLE: u32 = 0xc0000008; +pub const SMB_NTSTATUS_BAD_INITIAL_STACK: u32 = 0xc0000009; +pub const SMB_NTSTATUS_BAD_INITIAL_PC: u32 = 0xc000000a; +pub const SMB_NTSTATUS_INVALID_CID: u32 = 0xc000000b; +pub const SMB_NTSTATUS_TIMER_NOT_CANCELED: u32 = 0xc000000c; +pub const SMB_NTSTATUS_INVALID_PARAMETER: u32 = 0xc000000d; +pub const SMB_NTSTATUS_NO_SUCH_DEVICE: u32 = 0xc000000e; +pub const SMB_NTSTATUS_NO_SUCH_FILE: u32 = 0xc000000f; +pub const SMB_NTSTATUS_INVALID_DEVICE_REQUEST: u32 = 0xc0000010; +pub const SMB_NTSTATUS_END_OF_FILE: u32 = 0xc0000011; +pub const SMB_NTSTATUS_WRONG_VOLUME: u32 = 0xc0000012; +pub const SMB_NTSTATUS_NO_MEDIA_IN_DEVICE: u32 = 0xc0000013; +pub const SMB_NTSTATUS_UNRECOGNIZED_MEDIA: u32 = 0xc0000014; +pub const SMB_NTSTATUS_NONEXISTENT_SECTOR: u32 = 0xc0000015; +pub const SMB_NTSTATUS_MORE_PROCESSING_REQUIRED: u32 = 0xc0000016; +pub const SMB_NTSTATUS_NO_MEMORY: u32 = 0xc0000017; +pub const SMB_NTSTATUS_CONFLICTING_ADDRESSES: u32 = 0xc0000018; +pub const SMB_NTSTATUS_NOT_MAPPED_VIEW: u32 = 0xc0000019; +pub const SMB_NTSTATUS_UNABLE_TO_FREE_VM: u32 = 0xc000001a; +pub const SMB_NTSTATUS_UNABLE_TO_DELETE_SECTION: u32 = 0xc000001b; +pub const SMB_NTSTATUS_INVALID_SYSTEM_SERVICE: u32 = 0xc000001c; +pub const SMB_NTSTATUS_ILLEGAL_INSTRUCTION: u32 = 0xc000001d; +pub const SMB_NTSTATUS_INVALID_LOCK_SEQUENCE: u32 = 0xc000001e; +pub const SMB_NTSTATUS_INVALID_VIEW_SIZE: u32 = 0xc000001f; +pub const SMB_NTSTATUS_INVALID_FILE_FOR_SECTION: u32 = 0xc0000020; +pub const SMB_NTSTATUS_ALREADY_COMMITTED: u32 = 0xc0000021; +pub const SMB_NTSTATUS_ACCESS_DENIED: u32 = 0xc0000022; +pub const SMB_NTSTATUS_BUFFER_TOO_SMALL: u32 = 0xc0000023; +pub const SMB_NTSTATUS_OBJECT_TYPE_MISMATCH: u32 = 0xc0000024; +pub const SMB_NTSTATUS_NONCONTINUABLE_EXCEPTION: u32 = 0xc0000025; +pub const SMB_NTSTATUS_INVALID_DISPOSITION: u32 = 0xc0000026; +pub const SMB_NTSTATUS_UNWIND: u32 = 0xc0000027; +pub const SMB_NTSTATUS_BAD_STACK: u32 = 0xc0000028; +pub const SMB_NTSTATUS_INVALID_UNWIND_TARGET: u32 = 0xc0000029; +pub const SMB_NTSTATUS_NOT_LOCKED: u32 = 0xc000002a; +pub const SMB_NTSTATUS_PARITY_ERROR: u32 = 0xc000002b; +pub const SMB_NTSTATUS_UNABLE_TO_DECOMMIT_VM: u32 = 0xc000002c; +pub const SMB_NTSTATUS_NOT_COMMITTED: u32 = 0xc000002d; +pub const SMB_NTSTATUS_INVALID_PORT_ATTRIBUTES: u32 = 0xc000002e; +pub const SMB_NTSTATUS_PORT_MESSAGE_TOO_LONG: u32 = 0xc000002f; +pub const SMB_NTSTATUS_INVALID_PARAMETER_MIX: u32 = 0xc0000030; +pub const SMB_NTSTATUS_INVALID_QUOTA_LOWER: u32 = 0xc0000031; +pub const SMB_NTSTATUS_DISK_CORRUPT_ERROR: u32 = 0xc0000032; +pub const SMB_NTSTATUS_OBJECT_NAME_INVALID: u32 = 0xc0000033; +pub const SMB_NTSTATUS_OBJECT_NAME_NOT_FOUND: u32 = 0xc0000034; +pub const SMB_NTSTATUS_OBJECT_NAME_COLLISION: u32 = 0xc0000035; +pub const SMB_NTSTATUS_PORT_DISCONNECTED: u32 = 0xc0000037; +pub const SMB_NTSTATUS_DEVICE_ALREADY_ATTACHED: u32 = 0xc0000038; +pub const SMB_NTSTATUS_OBJECT_PATH_INVALID: u32 = 0xc0000039; +pub const SMB_NTSTATUS_OBJECT_PATH_NOT_FOUND: u32 = 0xc000003a; +pub const SMB_NTSTATUS_OBJECT_PATH_SYNTAX_BAD: u32 = 0xc000003b; +pub const SMB_NTSTATUS_DATA_OVERRUN: u32 = 0xc000003c; +pub const SMB_NTSTATUS_DATA_LATE_ERROR: u32 = 0xc000003d; +pub const SMB_NTSTATUS_DATA_ERROR: u32 = 0xc000003e; +pub const SMB_NTSTATUS_CRC_ERROR: u32 = 0xc000003f; +pub const SMB_NTSTATUS_SECTION_TOO_BIG: u32 = 0xc0000040; +pub const SMB_NTSTATUS_PORT_CONNECTION_REFUSED: u32 = 0xc0000041; +pub const SMB_NTSTATUS_INVALID_PORT_HANDLE: u32 = 0xc0000042; +pub const SMB_NTSTATUS_SHARING_VIOLATION: u32 = 0xc0000043; +pub const SMB_NTSTATUS_QUOTA_EXCEEDED: u32 = 0xc0000044; +pub const SMB_NTSTATUS_INVALID_PAGE_PROTECTION: u32 = 0xc0000045; +pub const SMB_NTSTATUS_MUTANT_NOT_OWNED: u32 = 0xc0000046; +pub const SMB_NTSTATUS_SEMAPHORE_LIMIT_EXCEEDED: u32 = 0xc0000047; +pub const SMB_NTSTATUS_PORT_ALREADY_SET: u32 = 0xc0000048; +pub const SMB_NTSTATUS_SECTION_NOT_IMAGE: u32 = 0xc0000049; +pub const SMB_NTSTATUS_SUSPEND_COUNT_EXCEEDED: u32 = 0xc000004a; +pub const SMB_NTSTATUS_THREAD_IS_TERMINATING: u32 = 0xc000004b; +pub const SMB_NTSTATUS_BAD_WORKING_SET_LIMIT: u32 = 0xc000004c; +pub const SMB_NTSTATUS_INCOMPATIBLE_FILE_MAP: u32 = 0xc000004d; +pub const SMB_NTSTATUS_SECTION_PROTECTION: u32 = 0xc000004e; +pub const SMB_NTSTATUS_EAS_NOT_SUPPORTED: u32 = 0xc000004f; +pub const SMB_NTSTATUS_EA_TOO_LARGE: u32 = 0xc0000050; +pub const SMB_NTSTATUS_NONEXISTENT_EA_ENTRY: u32 = 0xc0000051; +pub const SMB_NTSTATUS_NO_EAS_ON_FILE: u32 = 0xc0000052; +pub const SMB_NTSTATUS_EA_CORRUPT_ERROR: u32 = 0xc0000053; +pub const SMB_NTSTATUS_FILE_LOCK_CONFLICT: u32 = 0xc0000054; +pub const SMB_NTSTATUS_LOCK_NOT_GRANTED: u32 = 0xc0000055; +pub const SMB_NTSTATUS_DELETE_PENDING: u32 = 0xc0000056; +pub const SMB_NTSTATUS_CTL_FILE_NOT_SUPPORTED: u32 = 0xc0000057; +pub const SMB_NTSTATUS_UNKNOWN_REVISION: u32 = 0xc0000058; +pub const SMB_NTSTATUS_REVISION_MISMATCH: u32 = 0xc0000059; +pub const SMB_NTSTATUS_INVALID_OWNER: u32 = 0xc000005a; +pub const SMB_NTSTATUS_INVALID_PRIMARY_GROUP: u32 = 0xc000005b; +pub const SMB_NTSTATUS_NO_IMPERSONATION_TOKEN: u32 = 0xc000005c; +pub const SMB_NTSTATUS_CANT_DISABLE_MANDATORY: u32 = 0xc000005d; +pub const SMB_NTSTATUS_NO_LOGON_SERVERS: u32 = 0xc000005e; +pub const SMB_NTSTATUS_NO_SUCH_LOGON_SESSION: u32 = 0xc000005f; +pub const SMB_NTSTATUS_NO_SUCH_PRIVILEGE: u32 = 0xc0000060; +pub const SMB_NTSTATUS_PRIVILEGE_NOT_HELD: u32 = 0xc0000061; +pub const SMB_NTSTATUS_INVALID_ACCOUNT_NAME: u32 = 0xc0000062; +pub const SMB_NTSTATUS_USER_EXISTS: u32 = 0xc0000063; +pub const SMB_NTSTATUS_NO_SUCH_USER: u32 = 0xc0000064; +pub const SMB_NTSTATUS_GROUP_EXISTS: u32 = 0xc0000065; +pub const SMB_NTSTATUS_NO_SUCH_GROUP: u32 = 0xc0000066; +pub const SMB_NTSTATUS_MEMBER_IN_GROUP: u32 = 0xc0000067; +pub const SMB_NTSTATUS_MEMBER_NOT_IN_GROUP: u32 = 0xc0000068; +pub const SMB_NTSTATUS_LAST_ADMIN: u32 = 0xc0000069; +pub const SMB_NTSTATUS_WRONG_PASSWORD: u32 = 0xc000006a; +pub const SMB_NTSTATUS_ILL_FORMED_PASSWORD: u32 = 0xc000006b; +pub const SMB_NTSTATUS_PASSWORD_RESTRICTION: u32 = 0xc000006c; +pub const SMB_NTSTATUS_LOGON_FAILURE: u32 = 0xc000006d; +pub const SMB_NTSTATUS_ACCOUNT_RESTRICTION: u32 = 0xc000006e; +pub const SMB_NTSTATUS_INVALID_LOGON_HOURS: u32 = 0xc000006f; +pub const SMB_NTSTATUS_INVALID_WORKSTATION: u32 = 0xc0000070; +pub const SMB_NTSTATUS_PASSWORD_EXPIRED: u32 = 0xc0000071; +pub const SMB_NTSTATUS_ACCOUNT_DISABLED: u32 = 0xc0000072; +pub const SMB_NTSTATUS_NONE_MAPPED: u32 = 0xc0000073; +pub const SMB_NTSTATUS_TOO_MANY_LUIDS_REQUESTED: u32 = 0xc0000074; +pub const SMB_NTSTATUS_LUIDS_EXHAUSTED: u32 = 0xc0000075; +pub const SMB_NTSTATUS_INVALID_SUB_AUTHORITY: u32 = 0xc0000076; +pub const SMB_NTSTATUS_INVALID_ACL: u32 = 0xc0000077; +pub const SMB_NTSTATUS_INVALID_SID: u32 = 0xc0000078; +pub const SMB_NTSTATUS_INVALID_SECURITY_DESCR: u32 = 0xc0000079; +pub const SMB_NTSTATUS_PROCEDURE_NOT_FOUND: u32 = 0xc000007a; +pub const SMB_NTSTATUS_INVALID_IMAGE_FORMAT: u32 = 0xc000007b; +pub const SMB_NTSTATUS_NO_TOKEN: u32 = 0xc000007c; +pub const SMB_NTSTATUS_BAD_INHERITANCE_ACL: u32 = 0xc000007d; +pub const SMB_NTSTATUS_RANGE_NOT_LOCKED: u32 = 0xc000007e; +pub const SMB_NTSTATUS_DISK_FULL: u32 = 0xc000007f; +pub const SMB_NTSTATUS_SERVER_DISABLED: u32 = 0xc0000080; +pub const SMB_NTSTATUS_SERVER_NOT_DISABLED: u32 = 0xc0000081; +pub const SMB_NTSTATUS_TOO_MANY_GUIDS_REQUESTED: u32 = 0xc0000082; +pub const SMB_NTSTATUS_GUIDS_EXHAUSTED: u32 = 0xc0000083; +pub const SMB_NTSTATUS_INVALID_ID_AUTHORITY: u32 = 0xc0000084; +pub const SMB_NTSTATUS_AGENTS_EXHAUSTED: u32 = 0xc0000085; +pub const SMB_NTSTATUS_INVALID_VOLUME_LABEL: u32 = 0xc0000086; +pub const SMB_NTSTATUS_SECTION_NOT_EXTENDED: u32 = 0xc0000087; +pub const SMB_NTSTATUS_NOT_MAPPED_DATA: u32 = 0xc0000088; +pub const SMB_NTSTATUS_RESOURCE_DATA_NOT_FOUND: u32 = 0xc0000089; +pub const SMB_NTSTATUS_RESOURCE_TYPE_NOT_FOUND: u32 = 0xc000008a; +pub const SMB_NTSTATUS_RESOURCE_NAME_NOT_FOUND: u32 = 0xc000008b; +pub const SMB_NTSTATUS_ARRAY_BOUNDS_EXCEEDED: u32 = 0xc000008c; +pub const SMB_NTSTATUS_FLOAT_DENORMAL_OPERAND: u32 = 0xc000008d; +pub const SMB_NTSTATUS_FLOAT_DIVIDE_BY_ZERO: u32 = 0xc000008e; +pub const SMB_NTSTATUS_FLOAT_INEXACT_RESULT: u32 = 0xc000008f; +pub const SMB_NTSTATUS_FLOAT_INVALID_OPERATION: u32 = 0xc0000090; +pub const SMB_NTSTATUS_FLOAT_OVERFLOW: u32 = 0xc0000091; +pub const SMB_NTSTATUS_FLOAT_STACK_CHECK: u32 = 0xc0000092; +pub const SMB_NTSTATUS_FLOAT_UNDERFLOW: u32 = 0xc0000093; +pub const SMB_NTSTATUS_INTEGER_DIVIDE_BY_ZERO: u32 = 0xc0000094; +pub const SMB_NTSTATUS_INTEGER_OVERFLOW: u32 = 0xc0000095; +pub const SMB_NTSTATUS_PRIVILEGED_INSTRUCTION: u32 = 0xc0000096; +pub const SMB_NTSTATUS_TOO_MANY_PAGING_FILES: u32 = 0xc0000097; +pub const SMB_NTSTATUS_FILE_INVALID: u32 = 0xc0000098; +pub const SMB_NTSTATUS_ALLOTTED_SPACE_EXCEEDED: u32 = 0xc0000099; +pub const SMB_NTSTATUS_INSUFFICIENT_RESOURCES: u32 = 0xc000009a; +pub const SMB_NTSTATUS_DFS_EXIT_PATH_FOUND: u32 = 0xc000009b; +pub const SMB_NTSTATUS_DEVICE_DATA_ERROR: u32 = 0xc000009c; +pub const SMB_NTSTATUS_DEVICE_NOT_CONNECTED: u32 = 0xc000009d; +pub const SMB_NTSTATUS_FREE_VM_NOT_AT_BASE: u32 = 0xc000009f; +pub const SMB_NTSTATUS_MEMORY_NOT_ALLOCATED: u32 = 0xc00000a0; +pub const SMB_NTSTATUS_WORKING_SET_QUOTA: u32 = 0xc00000a1; +pub const SMB_NTSTATUS_MEDIA_WRITE_PROTECTED: u32 = 0xc00000a2; +pub const SMB_NTSTATUS_DEVICE_NOT_READY: u32 = 0xc00000a3; +pub const SMB_NTSTATUS_INVALID_GROUP_ATTRIBUTES: u32 = 0xc00000a4; +pub const SMB_NTSTATUS_BAD_IMPERSONATION_LEVEL: u32 = 0xc00000a5; +pub const SMB_NTSTATUS_CANT_OPEN_ANONYMOUS: u32 = 0xc00000a6; +pub const SMB_NTSTATUS_BAD_VALIDATION_CLASS: u32 = 0xc00000a7; +pub const SMB_NTSTATUS_BAD_TOKEN_TYPE: u32 = 0xc00000a8; +pub const SMB_NTSTATUS_BAD_MASTER_BOOT_RECORD: u32 = 0xc00000a9; +pub const SMB_NTSTATUS_INSTRUCTION_MISALIGNMENT: u32 = 0xc00000aa; +pub const SMB_NTSTATUS_INSTANCE_NOT_AVAILABLE: u32 = 0xc00000ab; +pub const SMB_NTSTATUS_PIPE_NOT_AVAILABLE: u32 = 0xc00000ac; +pub const SMB_NTSTATUS_INVALID_PIPE_STATE: u32 = 0xc00000ad; +pub const SMB_NTSTATUS_PIPE_BUSY: u32 = 0xc00000ae; +pub const SMB_NTSTATUS_ILLEGAL_FUNCTION: u32 = 0xc00000af; +pub const SMB_NTSTATUS_PIPE_DISCONNECTED: u32 = 0xc00000b0; +pub const SMB_NTSTATUS_PIPE_CLOSING: u32 = 0xc00000b1; +pub const SMB_NTSTATUS_PIPE_CONNECTED: u32 = 0xc00000b2; +pub const SMB_NTSTATUS_PIPE_LISTENING: u32 = 0xc00000b3; +pub const SMB_NTSTATUS_INVALID_READ_MODE: u32 = 0xc00000b4; +pub const SMB_NTSTATUS_IO_TIMEOUT: u32 = 0xc00000b5; +pub const SMB_NTSTATUS_FILE_FORCED_CLOSED: u32 = 0xc00000b6; +pub const SMB_NTSTATUS_PROFILING_NOT_STARTED: u32 = 0xc00000b7; +pub const SMB_NTSTATUS_PROFILING_NOT_STOPPED: u32 = 0xc00000b8; +pub const SMB_NTSTATUS_COULD_NOT_INTERPRET: u32 = 0xc00000b9; +pub const SMB_NTSTATUS_FILE_IS_A_DIRECTORY: u32 = 0xc00000ba; +pub const SMB_NTSTATUS_NOT_SUPPORTED: u32 = 0xc00000bb; +pub const SMB_NTSTATUS_REMOTE_NOT_LISTENING: u32 = 0xc00000bc; +pub const SMB_NTSTATUS_DUPLICATE_NAME: u32 = 0xc00000bd; +pub const SMB_NTSTATUS_BAD_NETWORK_PATH: u32 = 0xc00000be; +pub const SMB_NTSTATUS_NETWORK_BUSY: u32 = 0xc00000bf; +pub const SMB_NTSTATUS_DEVICE_DOES_NOT_EXIST: u32 = 0xc00000c0; +pub const SMB_NTSTATUS_TOO_MANY_COMMANDS: u32 = 0xc00000c1; +pub const SMB_NTSTATUS_ADAPTER_HARDWARE_ERROR: u32 = 0xc00000c2; +pub const SMB_NTSTATUS_INVALID_NETWORK_RESPONSE: u32 = 0xc00000c3; +pub const SMB_NTSTATUS_UNEXPECTED_NETWORK_ERROR: u32 = 0xc00000c4; +pub const SMB_NTSTATUS_BAD_REMOTE_ADAPTER: u32 = 0xc00000c5; +pub const SMB_NTSTATUS_PRINT_QUEUE_FULL: u32 = 0xc00000c6; +pub const SMB_NTSTATUS_NO_SPOOL_SPACE: u32 = 0xc00000c7; +pub const SMB_NTSTATUS_PRINT_CANCELLED: u32 = 0xc00000c8; +pub const SMB_NTSTATUS_NETWORK_NAME_DELETED: u32 = 0xc00000c9; +pub const SMB_NTSTATUS_NETWORK_ACCESS_DENIED: u32 = 0xc00000ca; +pub const SMB_NTSTATUS_BAD_DEVICE_TYPE: u32 = 0xc00000cb; +pub const SMB_NTSTATUS_BAD_NETWORK_NAME: u32 = 0xc00000cc; +pub const SMB_NTSTATUS_TOO_MANY_NAMES: u32 = 0xc00000cd; +pub const SMB_NTSTATUS_TOO_MANY_SESSIONS: u32 = 0xc00000ce; +pub const SMB_NTSTATUS_SHARING_PAUSED: u32 = 0xc00000cf; +pub const SMB_NTSTATUS_REQUEST_NOT_ACCEPTED: u32 = 0xc00000d0; +pub const SMB_NTSTATUS_REDIRECTOR_PAUSED: u32 = 0xc00000d1; +pub const SMB_NTSTATUS_NET_WRITE_FAULT: u32 = 0xc00000d2; +pub const SMB_NTSTATUS_PROFILING_AT_LIMIT: u32 = 0xc00000d3; +pub const SMB_NTSTATUS_NOT_SAME_DEVICE: u32 = 0xc00000d4; +pub const SMB_NTSTATUS_FILE_RENAMED: u32 = 0xc00000d5; +pub const SMB_NTSTATUS_VIRTUAL_CIRCUIT_CLOSED: u32 = 0xc00000d6; +pub const SMB_NTSTATUS_NO_SECURITY_ON_OBJECT: u32 = 0xc00000d7; +pub const SMB_NTSTATUS_CANT_WAIT: u32 = 0xc00000d8; +pub const SMB_NTSTATUS_PIPE_EMPTY: u32 = 0xc00000d9; +pub const SMB_NTSTATUS_CANT_ACCESS_DOMAIN_INFO: u32 = 0xc00000da; +pub const SMB_NTSTATUS_CANT_TERMINATE_SELF: u32 = 0xc00000db; +pub const SMB_NTSTATUS_INVALID_SERVER_STATE: u32 = 0xc00000dc; +pub const SMB_NTSTATUS_INVALID_DOMAIN_STATE: u32 = 0xc00000dd; +pub const SMB_NTSTATUS_INVALID_DOMAIN_ROLE: u32 = 0xc00000de; +pub const SMB_NTSTATUS_NO_SUCH_DOMAIN: u32 = 0xc00000df; +pub const SMB_NTSTATUS_DOMAIN_EXISTS: u32 = 0xc00000e0; +pub const SMB_NTSTATUS_DOMAIN_LIMIT_EXCEEDED: u32 = 0xc00000e1; +pub const SMB_NTSTATUS_OPLOCK_NOT_GRANTED: u32 = 0xc00000e2; +pub const SMB_NTSTATUS_INVALID_OPLOCK_PROTOCOL: u32 = 0xc00000e3; +pub const SMB_NTSTATUS_INTERNAL_DB_CORRUPTION: u32 = 0xc00000e4; +pub const SMB_NTSTATUS_INTERNAL_ERROR: u32 = 0xc00000e5; +pub const SMB_NTSTATUS_GENERIC_NOT_MAPPED: u32 = 0xc00000e6; +pub const SMB_NTSTATUS_BAD_DESCRIPTOR_FORMAT: u32 = 0xc00000e7; +pub const SMB_NTSTATUS_INVALID_USER_BUFFER: u32 = 0xc00000e8; +pub const SMB_NTSTATUS_UNEXPECTED_IO_ERROR: u32 = 0xc00000e9; +pub const SMB_NTSTATUS_UNEXPECTED_MM_CREATE_ERR: u32 = 0xc00000ea; +pub const SMB_NTSTATUS_UNEXPECTED_MM_MAP_ERROR: u32 = 0xc00000eb; +pub const SMB_NTSTATUS_UNEXPECTED_MM_EXTEND_ERR: u32 = 0xc00000ec; +pub const SMB_NTSTATUS_NOT_LOGON_PROCESS: u32 = 0xc00000ed; +pub const SMB_NTSTATUS_LOGON_SESSION_EXISTS: u32 = 0xc00000ee; +pub const SMB_NTSTATUS_INVALID_PARAMETER_1: u32 = 0xc00000ef; +pub const SMB_NTSTATUS_INVALID_PARAMETER_2: u32 = 0xc00000f0; +pub const SMB_NTSTATUS_INVALID_PARAMETER_3: u32 = 0xc00000f1; +pub const SMB_NTSTATUS_INVALID_PARAMETER_4: u32 = 0xc00000f2; +pub const SMB_NTSTATUS_INVALID_PARAMETER_5: u32 = 0xc00000f3; +pub const SMB_NTSTATUS_INVALID_PARAMETER_6: u32 = 0xc00000f4; +pub const SMB_NTSTATUS_INVALID_PARAMETER_7: u32 = 0xc00000f5; +pub const SMB_NTSTATUS_INVALID_PARAMETER_8: u32 = 0xc00000f6; +pub const SMB_NTSTATUS_INVALID_PARAMETER_9: u32 = 0xc00000f7; +pub const SMB_NTSTATUS_INVALID_PARAMETER_10: u32 = 0xc00000f8; +pub const SMB_NTSTATUS_INVALID_PARAMETER_11: u32 = 0xc00000f9; +pub const SMB_NTSTATUS_INVALID_PARAMETER_12: u32 = 0xc00000fa; +pub const SMB_NTSTATUS_REDIRECTOR_NOT_STARTED: u32 = 0xc00000fb; +pub const SMB_NTSTATUS_REDIRECTOR_STARTED: u32 = 0xc00000fc; +pub const SMB_NTSTATUS_STACK_OVERFLOW: u32 = 0xc00000fd; +pub const SMB_NTSTATUS_NO_SUCH_PACKAGE: u32 = 0xc00000fe; +pub const SMB_NTSTATUS_BAD_FUNCTION_TABLE: u32 = 0xc00000ff; +pub const SMB_NTSTATUS_VARIABLE_NOT_FOUND: u32 = 0xc0000100; +pub const SMB_NTSTATUS_DIRECTORY_NOT_EMPTY: u32 = 0xc0000101; +pub const SMB_NTSTATUS_FILE_CORRUPT_ERROR: u32 = 0xc0000102; +pub const SMB_NTSTATUS_NOT_A_DIRECTORY: u32 = 0xc0000103; +pub const SMB_NTSTATUS_BAD_LOGON_SESSION_STATE: u32 = 0xc0000104; +pub const SMB_NTSTATUS_LOGON_SESSION_COLLISION: u32 = 0xc0000105; +pub const SMB_NTSTATUS_NAME_TOO_LONG: u32 = 0xc0000106; +pub const SMB_NTSTATUS_FILES_OPEN: u32 = 0xc0000107; +pub const SMB_NTSTATUS_CONNECTION_IN_USE: u32 = 0xc0000108; +pub const SMB_NTSTATUS_MESSAGE_NOT_FOUND: u32 = 0xc0000109; +pub const SMB_NTSTATUS_PROCESS_IS_TERMINATING: u32 = 0xc000010a; +pub const SMB_NTSTATUS_INVALID_LOGON_TYPE: u32 = 0xc000010b; +pub const SMB_NTSTATUS_NO_GUID_TRANSLATION: u32 = 0xc000010c; +pub const SMB_NTSTATUS_CANNOT_IMPERSONATE: u32 = 0xc000010d; +pub const SMB_NTSTATUS_IMAGE_ALREADY_LOADED: u32 = 0xc000010e; +pub const SMB_NTSTATUS_NO_LDT: u32 = 0xc0000117; +pub const SMB_NTSTATUS_INVALID_LDT_SIZE: u32 = 0xc0000118; +pub const SMB_NTSTATUS_INVALID_LDT_OFFSET: u32 = 0xc0000119; +pub const SMB_NTSTATUS_INVALID_LDT_DESCRIPTOR: u32 = 0xc000011a; +pub const SMB_NTSTATUS_INVALID_IMAGE_NE_FORMAT: u32 = 0xc000011b; +pub const SMB_NTSTATUS_RXACT_INVALID_STATE: u32 = 0xc000011c; +pub const SMB_NTSTATUS_RXACT_COMMIT_FAILURE: u32 = 0xc000011d; +pub const SMB_NTSTATUS_MAPPED_FILE_SIZE_ZERO: u32 = 0xc000011e; +pub const SMB_NTSTATUS_TOO_MANY_OPENED_FILES: u32 = 0xc000011f; +pub const SMB_NTSTATUS_CANCELLED: u32 = 0xc0000120; +pub const SMB_NTSTATUS_CANNOT_DELETE: u32 = 0xc0000121; +pub const SMB_NTSTATUS_INVALID_COMPUTER_NAME: u32 = 0xc0000122; +pub const SMB_NTSTATUS_FILE_DELETED: u32 = 0xc0000123; +pub const SMB_NTSTATUS_SPECIAL_ACCOUNT: u32 = 0xc0000124; +pub const SMB_NTSTATUS_SPECIAL_GROUP: u32 = 0xc0000125; +pub const SMB_NTSTATUS_SPECIAL_USER: u32 = 0xc0000126; +pub const SMB_NTSTATUS_MEMBERS_PRIMARY_GROUP: u32 = 0xc0000127; +pub const SMB_NTSTATUS_FILE_CLOSED: u32 = 0xc0000128; +pub const SMB_NTSTATUS_TOO_MANY_THREADS: u32 = 0xc0000129; +pub const SMB_NTSTATUS_THREAD_NOT_IN_PROCESS: u32 = 0xc000012a; +pub const SMB_NTSTATUS_TOKEN_ALREADY_IN_USE: u32 = 0xc000012b; +pub const SMB_NTSTATUS_PAGEFILE_QUOTA_EXCEEDED: u32 = 0xc000012c; +pub const SMB_NTSTATUS_COMMITMENT_LIMIT: u32 = 0xc000012d; +pub const SMB_NTSTATUS_INVALID_IMAGE_LE_FORMAT: u32 = 0xc000012e; +pub const SMB_NTSTATUS_INVALID_IMAGE_NOT_MZ: u32 = 0xc000012f; +pub const SMB_NTSTATUS_INVALID_IMAGE_PROTECT: u32 = 0xc0000130; +pub const SMB_NTSTATUS_INVALID_IMAGE_WIN_16: u32 = 0xc0000131; +pub const SMB_NTSTATUS_LOGON_SERVER_CONFLICT: u32 = 0xc0000132; +pub const SMB_NTSTATUS_TIME_DIFFERENCE_AT_DC: u32 = 0xc0000133; +pub const SMB_NTSTATUS_SYNCHRONIZATION_REQUIRED: u32 = 0xc0000134; +pub const SMB_NTSTATUS_DLL_NOT_FOUND: u32 = 0xc0000135; +pub const SMB_NTSTATUS_OPEN_FAILED: u32 = 0xc0000136; +pub const SMB_NTSTATUS_IO_PRIVILEGE_FAILED: u32 = 0xc0000137; +pub const SMB_NTSTATUS_ORDINAL_NOT_FOUND: u32 = 0xc0000138; +pub const SMB_NTSTATUS_ENTRYPOINT_NOT_FOUND: u32 = 0xc0000139; +pub const SMB_NTSTATUS_CONTROL_C_EXIT: u32 = 0xc000013a; +pub const SMB_NTSTATUS_LOCAL_DISCONNECT: u32 = 0xc000013b; +pub const SMB_NTSTATUS_REMOTE_DISCONNECT: u32 = 0xc000013c; +pub const SMB_NTSTATUS_REMOTE_RESOURCES: u32 = 0xc000013d; +pub const SMB_NTSTATUS_LINK_FAILED: u32 = 0xc000013e; +pub const SMB_NTSTATUS_LINK_TIMEOUT: u32 = 0xc000013f; +pub const SMB_NTSTATUS_INVALID_CONNECTION: u32 = 0xc0000140; +pub const SMB_NTSTATUS_INVALID_ADDRESS: u32 = 0xc0000141; +pub const SMB_NTSTATUS_DLL_INIT_FAILED: u32 = 0xc0000142; +pub const SMB_NTSTATUS_MISSING_SYSTEMFILE: u32 = 0xc0000143; +pub const SMB_NTSTATUS_UNHANDLED_EXCEPTION: u32 = 0xc0000144; +pub const SMB_NTSTATUS_APP_INIT_FAILURE: u32 = 0xc0000145; +pub const SMB_NTSTATUS_PAGEFILE_CREATE_FAILED: u32 = 0xc0000146; +pub const SMB_NTSTATUS_NO_PAGEFILE: u32 = 0xc0000147; +pub const SMB_NTSTATUS_INVALID_LEVEL: u32 = 0xc0000148; +pub const SMB_NTSTATUS_WRONG_PASSWORD_CORE: u32 = 0xc0000149; +pub const SMB_NTSTATUS_ILLEGAL_FLOAT_CONTEXT: u32 = 0xc000014a; +pub const SMB_NTSTATUS_PIPE_BROKEN: u32 = 0xc000014b; +pub const SMB_NTSTATUS_REGISTRY_CORRUPT: u32 = 0xc000014c; +pub const SMB_NTSTATUS_REGISTRY_IO_FAILED: u32 = 0xc000014d; +pub const SMB_NTSTATUS_NO_EVENT_PAIR: u32 = 0xc000014e; +pub const SMB_NTSTATUS_UNRECOGNIZED_VOLUME: u32 = 0xc000014f; +pub const SMB_NTSTATUS_SERIAL_NO_DEVICE_INITED: u32 = 0xc0000150; +pub const SMB_NTSTATUS_NO_SUCH_ALIAS: u32 = 0xc0000151; +pub const SMB_NTSTATUS_MEMBER_NOT_IN_ALIAS: u32 = 0xc0000152; +pub const SMB_NTSTATUS_MEMBER_IN_ALIAS: u32 = 0xc0000153; +pub const SMB_NTSTATUS_ALIAS_EXISTS: u32 = 0xc0000154; +pub const SMB_NTSTATUS_LOGON_NOT_GRANTED: u32 = 0xc0000155; +pub const SMB_NTSTATUS_TOO_MANY_SECRETS: u32 = 0xc0000156; +pub const SMB_NTSTATUS_SECRET_TOO_LONG: u32 = 0xc0000157; +pub const SMB_NTSTATUS_INTERNAL_DB_ERROR: u32 = 0xc0000158; +pub const SMB_NTSTATUS_FULLSCREEN_MODE: u32 = 0xc0000159; +pub const SMB_NTSTATUS_TOO_MANY_CONTEXT_IDS: u32 = 0xc000015a; +pub const SMB_NTSTATUS_LOGON_TYPE_NOT_GRANTED: u32 = 0xc000015b; +pub const SMB_NTSTATUS_NOT_REGISTRY_FILE: u32 = 0xc000015c; +pub const SMB_NTSTATUS_NT_CROSS_ENCRYPTION_REQUIRED: u32 = 0xc000015d; +pub const SMB_NTSTATUS_DOMAIN_CTRLR_CONFIG_ERROR: u32 = 0xc000015e; +pub const SMB_NTSTATUS_FT_MISSING_MEMBER: u32 = 0xc000015f; +pub const SMB_NTSTATUS_ILL_FORMED_SERVICE_ENTRY: u32 = 0xc0000160; +pub const SMB_NTSTATUS_ILLEGAL_CHARACTER: u32 = 0xc0000161; +pub const SMB_NTSTATUS_UNMAPPABLE_CHARACTER: u32 = 0xc0000162; +pub const SMB_NTSTATUS_UNDEFINED_CHARACTER: u32 = 0xc0000163; +pub const SMB_NTSTATUS_FLOPPY_VOLUME: u32 = 0xc0000164; +pub const SMB_NTSTATUS_FLOPPY_ID_MARK_NOT_FOUND: u32 = 0xc0000165; +pub const SMB_NTSTATUS_FLOPPY_WRONG_CYLINDER: u32 = 0xc0000166; +pub const SMB_NTSTATUS_FLOPPY_UNKNOWN_ERROR: u32 = 0xc0000167; +pub const SMB_NTSTATUS_FLOPPY_BAD_REGISTERS: u32 = 0xc0000168; +pub const SMB_NTSTATUS_DISK_RECALIBRATE_FAILED: u32 = 0xc0000169; +pub const SMB_NTSTATUS_DISK_OPERATION_FAILED: u32 = 0xc000016a; +pub const SMB_NTSTATUS_DISK_RESET_FAILED: u32 = 0xc000016b; +pub const SMB_NTSTATUS_SHARED_IRQ_BUSY: u32 = 0xc000016c; +pub const SMB_NTSTATUS_FT_ORPHANING: u32 = 0xc000016d; +pub const SMB_NTSTATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT: u32 = 0xc000016e; +pub const SMB_NTSTATUS_PARTITION_FAILURE: u32 = 0xc0000172; +pub const SMB_NTSTATUS_INVALID_BLOCK_LENGTH: u32 = 0xc0000173; +pub const SMB_NTSTATUS_DEVICE_NOT_PARTITIONED: u32 = 0xc0000174; +pub const SMB_NTSTATUS_UNABLE_TO_LOCK_MEDIA: u32 = 0xc0000175; +pub const SMB_NTSTATUS_UNABLE_TO_UNLOAD_MEDIA: u32 = 0xc0000176; +pub const SMB_NTSTATUS_EOM_OVERFLOW: u32 = 0xc0000177; +pub const SMB_NTSTATUS_NO_MEDIA: u32 = 0xc0000178; +pub const SMB_NTSTATUS_NO_SUCH_MEMBER: u32 = 0xc000017a; +pub const SMB_NTSTATUS_INVALID_MEMBER: u32 = 0xc000017b; +pub const SMB_NTSTATUS_KEY_DELETED: u32 = 0xc000017c; +pub const SMB_NTSTATUS_NO_LOG_SPACE: u32 = 0xc000017d; +pub const SMB_NTSTATUS_TOO_MANY_SIDS: u32 = 0xc000017e; +pub const SMB_NTSTATUS_LM_CROSS_ENCRYPTION_REQUIRED: u32 = 0xc000017f; +pub const SMB_NTSTATUS_KEY_HAS_CHILDREN: u32 = 0xc0000180; +pub const SMB_NTSTATUS_CHILD_MUST_BE_VOLATILE: u32 = 0xc0000181; +pub const SMB_NTSTATUS_DEVICE_CONFIGURATION_ERROR: u32 = 0xc0000182; +pub const SMB_NTSTATUS_DRIVER_INTERNAL_ERROR: u32 = 0xc0000183; +pub const SMB_NTSTATUS_INVALID_DEVICE_STATE: u32 = 0xc0000184; +pub const SMB_NTSTATUS_IO_DEVICE_ERROR: u32 = 0xc0000185; +pub const SMB_NTSTATUS_DEVICE_PROTOCOL_ERROR: u32 = 0xc0000186; +pub const SMB_NTSTATUS_BACKUP_CONTROLLER: u32 = 0xc0000187; +pub const SMB_NTSTATUS_LOG_FILE_FULL: u32 = 0xc0000188; +pub const SMB_NTSTATUS_TOO_LATE: u32 = 0xc0000189; +pub const SMB_NTSTATUS_NO_TRUST_LSA_SECRET: u32 = 0xc000018a; +pub const SMB_NTSTATUS_NO_TRUST_SAM_ACCOUNT: u32 = 0xc000018b; +pub const SMB_NTSTATUS_TRUSTED_DOMAIN_FAILURE: u32 = 0xc000018c; +pub const SMB_NTSTATUS_TRUSTED_RELATIONSHIP_FAILURE: u32 = 0xc000018d; +pub const SMB_NTSTATUS_EVENTLOG_FILE_CORRUPT: u32 = 0xc000018e; +pub const SMB_NTSTATUS_EVENTLOG_CANT_START: u32 = 0xc000018f; +pub const SMB_NTSTATUS_TRUST_FAILURE: u32 = 0xc0000190; +pub const SMB_NTSTATUS_MUTANT_LIMIT_EXCEEDED: u32 = 0xc0000191; +pub const SMB_NTSTATUS_NETLOGON_NOT_STARTED: u32 = 0xc0000192; +pub const SMB_NTSTATUS_ACCOUNT_EXPIRED: u32 = 0xc0000193; +pub const SMB_NTSTATUS_POSSIBLE_DEADLOCK: u32 = 0xc0000194; +pub const SMB_NTSTATUS_NETWORK_CREDENTIAL_CONFLICT: u32 = 0xc0000195; +pub const SMB_NTSTATUS_REMOTE_SESSION_LIMIT: u32 = 0xc0000196; +pub const SMB_NTSTATUS_EVENTLOG_FILE_CHANGED: u32 = 0xc0000197; +pub const SMB_NTSTATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: u32 = 0xc0000198; +pub const SMB_NTSTATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT: u32 = 0xc0000199; +pub const SMB_NTSTATUS_NOLOGON_SERVER_TRUST_ACCOUNT: u32 = 0xc000019a; +pub const SMB_NTSTATUS_DOMAIN_TRUST_INCONSISTENT: u32 = 0xc000019b; +pub const SMB_NTSTATUS_FS_DRIVER_REQUIRED: u32 = 0xc000019c; +pub const SMB_NTSTATUS_IMAGE_ALREADY_LOADED_AS_DLL: u32 = 0xc000019d; +pub const SMB_NTSTATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: u32 = 0xc000019e; +pub const SMB_NTSTATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: u32 = 0xc000019f; +pub const SMB_NTSTATUS_SECURITY_STREAM_IS_INCONSISTENT: u32 = 0xc00001a0; +pub const SMB_NTSTATUS_INVALID_LOCK_RANGE: u32 = 0xc00001a1; +pub const SMB_NTSTATUS_INVALID_ACE_CONDITION: u32 = 0xc00001a2; +pub const SMB_NTSTATUS_IMAGE_SUBSYSTEM_NOT_PRESENT: u32 = 0xc00001a3; +pub const SMB_NTSTATUS_NOTIFICATION_GUID_ALREADY_DEFINED: u32 = 0xc00001a4; +pub const SMB_NTSTATUS_NETWORK_OPEN_RESTRICTION: u32 = 0xc0000201; +pub const SMB_NTSTATUS_NO_USER_SESSION_KEY: u32 = 0xc0000202; +pub const SMB_NTSTATUS_USER_SESSION_DELETED: u32 = 0xc0000203; +pub const SMB_NTSTATUS_RESOURCE_LANG_NOT_FOUND: u32 = 0xc0000204; +pub const SMB_NTSTATUS_INSUFF_SERVER_RESOURCES: u32 = 0xc0000205; +pub const SMB_NTSTATUS_INVALID_BUFFER_SIZE: u32 = 0xc0000206; +pub const SMB_NTSTATUS_INVALID_ADDRESS_COMPONENT: u32 = 0xc0000207; +pub const SMB_NTSTATUS_INVALID_ADDRESS_WILDCARD: u32 = 0xc0000208; +pub const SMB_NTSTATUS_TOO_MANY_ADDRESSES: u32 = 0xc0000209; +pub const SMB_NTSTATUS_ADDRESS_ALREADY_EXISTS: u32 = 0xc000020a; +pub const SMB_NTSTATUS_ADDRESS_CLOSED: u32 = 0xc000020b; +pub const SMB_NTSTATUS_CONNECTION_DISCONNECTED: u32 = 0xc000020c; +pub const SMB_NTSTATUS_CONNECTION_RESET: u32 = 0xc000020d; +pub const SMB_NTSTATUS_TOO_MANY_NODES: u32 = 0xc000020e; +pub const SMB_NTSTATUS_TRANSACTION_ABORTED: u32 = 0xc000020f; +pub const SMB_NTSTATUS_TRANSACTION_TIMED_OUT: u32 = 0xc0000210; +pub const SMB_NTSTATUS_TRANSACTION_NO_RELEASE: u32 = 0xc0000211; +pub const SMB_NTSTATUS_TRANSACTION_NO_MATCH: u32 = 0xc0000212; +pub const SMB_NTSTATUS_TRANSACTION_RESPONDED: u32 = 0xc0000213; +pub const SMB_NTSTATUS_TRANSACTION_INVALID_ID: u32 = 0xc0000214; +pub const SMB_NTSTATUS_TRANSACTION_INVALID_TYPE: u32 = 0xc0000215; +pub const SMB_NTSTATUS_NOT_SERVER_SESSION: u32 = 0xc0000216; +pub const SMB_NTSTATUS_NOT_CLIENT_SESSION: u32 = 0xc0000217; +pub const SMB_NTSTATUS_CANNOT_LOAD_REGISTRY_FILE: u32 = 0xc0000218; +pub const SMB_NTSTATUS_DEBUG_ATTACH_FAILED: u32 = 0xc0000219; +pub const SMB_NTSTATUS_SYSTEM_PROCESS_TERMINATED: u32 = 0xc000021a; +pub const SMB_NTSTATUS_DATA_NOT_ACCEPTED: u32 = 0xc000021b; +pub const SMB_NTSTATUS_NO_BROWSER_SERVERS_FOUND: u32 = 0xc000021c; +pub const SMB_NTSTATUS_VDM_HARD_ERROR: u32 = 0xc000021d; +pub const SMB_NTSTATUS_DRIVER_CANCEL_TIMEOUT: u32 = 0xc000021e; +pub const SMB_NTSTATUS_REPLY_MESSAGE_MISMATCH: u32 = 0xc000021f; +pub const SMB_NTSTATUS_MAPPED_ALIGNMENT: u32 = 0xc0000220; +pub const SMB_NTSTATUS_IMAGE_CHECKSUM_MISMATCH: u32 = 0xc0000221; +pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA: u32 = 0xc0000222; +pub const SMB_NTSTATUS_CLIENT_SERVER_PARAMETERS_INVALID: u32 = 0xc0000223; +pub const SMB_NTSTATUS_PASSWORD_MUST_CHANGE: u32 = 0xc0000224; +pub const SMB_NTSTATUS_NOT_FOUND: u32 = 0xc0000225; +pub const SMB_NTSTATUS_NOT_TINY_STREAM: u32 = 0xc0000226; +pub const SMB_NTSTATUS_RECOVERY_FAILURE: u32 = 0xc0000227; +pub const SMB_NTSTATUS_STACK_OVERFLOW_READ: u32 = 0xc0000228; +pub const SMB_NTSTATUS_FAIL_CHECK: u32 = 0xc0000229; +pub const SMB_NTSTATUS_DUPLICATE_OBJECTID: u32 = 0xc000022a; +pub const SMB_NTSTATUS_OBJECTID_EXISTS: u32 = 0xc000022b; +pub const SMB_NTSTATUS_CONVERT_TO_LARGE: u32 = 0xc000022c; +pub const SMB_NTSTATUS_RETRY: u32 = 0xc000022d; +pub const SMB_NTSTATUS_FOUND_OUT_OF_SCOPE: u32 = 0xc000022e; +pub const SMB_NTSTATUS_ALLOCATE_BUCKET: u32 = 0xc000022f; +pub const SMB_NTSTATUS_PROPSET_NOT_FOUND: u32 = 0xc0000230; +pub const SMB_NTSTATUS_MARSHALL_OVERFLOW: u32 = 0xc0000231; +pub const SMB_NTSTATUS_INVALID_VARIANT: u32 = 0xc0000232; +pub const SMB_NTSTATUS_DOMAIN_CONTROLLER_NOT_FOUND: u32 = 0xc0000233; +pub const SMB_NTSTATUS_ACCOUNT_LOCKED_OUT: u32 = 0xc0000234; +pub const SMB_NTSTATUS_HANDLE_NOT_CLOSABLE: u32 = 0xc0000235; +pub const SMB_NTSTATUS_CONNECTION_REFUSED: u32 = 0xc0000236; +pub const SMB_NTSTATUS_GRACEFUL_DISCONNECT: u32 = 0xc0000237; +pub const SMB_NTSTATUS_ADDRESS_ALREADY_ASSOCIATED: u32 = 0xc0000238; +pub const SMB_NTSTATUS_ADDRESS_NOT_ASSOCIATED: u32 = 0xc0000239; +pub const SMB_NTSTATUS_CONNECTION_INVALID: u32 = 0xc000023a; +pub const SMB_NTSTATUS_CONNECTION_ACTIVE: u32 = 0xc000023b; +pub const SMB_NTSTATUS_NETWORK_UNREACHABLE: u32 = 0xc000023c; +pub const SMB_NTSTATUS_HOST_UNREACHABLE: u32 = 0xc000023d; +pub const SMB_NTSTATUS_PROTOCOL_UNREACHABLE: u32 = 0xc000023e; +pub const SMB_NTSTATUS_PORT_UNREACHABLE: u32 = 0xc000023f; +pub const SMB_NTSTATUS_REQUEST_ABORTED: u32 = 0xc0000240; +pub const SMB_NTSTATUS_CONNECTION_ABORTED: u32 = 0xc0000241; +pub const SMB_NTSTATUS_BAD_COMPRESSION_BUFFER: u32 = 0xc0000242; +pub const SMB_NTSTATUS_USER_MAPPED_FILE: u32 = 0xc0000243; +pub const SMB_NTSTATUS_AUDIT_FAILED: u32 = 0xc0000244; +pub const SMB_NTSTATUS_TIMER_RESOLUTION_NOT_SET: u32 = 0xc0000245; +pub const SMB_NTSTATUS_CONNECTION_COUNT_LIMIT: u32 = 0xc0000246; +pub const SMB_NTSTATUS_LOGIN_TIME_RESTRICTION: u32 = 0xc0000247; +pub const SMB_NTSTATUS_LOGIN_WKSTA_RESTRICTION: u32 = 0xc0000248; +pub const SMB_NTSTATUS_IMAGE_MP_UP_MISMATCH: u32 = 0xc0000249; +pub const SMB_NTSTATUS_INSUFFICIENT_LOGON_INFO: u32 = 0xc0000250; +pub const SMB_NTSTATUS_BAD_DLL_ENTRYPOINT: u32 = 0xc0000251; +pub const SMB_NTSTATUS_BAD_SERVICE_ENTRYPOINT: u32 = 0xc0000252; +pub const SMB_NTSTATUS_LPC_REPLY_LOST: u32 = 0xc0000253; +pub const SMB_NTSTATUS_IP_ADDRESS_CONFLICT1: u32 = 0xc0000254; +pub const SMB_NTSTATUS_IP_ADDRESS_CONFLICT2: u32 = 0xc0000255; +pub const SMB_NTSTATUS_REGISTRY_QUOTA_LIMIT: u32 = 0xc0000256; +pub const SMB_NTSTATUS_PATH_NOT_COVERED: u32 = 0xc0000257; +pub const SMB_NTSTATUS_NO_CALLBACK_ACTIVE: u32 = 0xc0000258; +pub const SMB_NTSTATUS_LICENSE_QUOTA_EXCEEDED: u32 = 0xc0000259; +pub const SMB_NTSTATUS_PWD_TOO_SHORT: u32 = 0xc000025a; +pub const SMB_NTSTATUS_PWD_TOO_RECENT: u32 = 0xc000025b; +pub const SMB_NTSTATUS_PWD_HISTORY_CONFLICT: u32 = 0xc000025c; +pub const SMB_NTSTATUS_PLUGPLAY_NO_DEVICE: u32 = 0xc000025e; +pub const SMB_NTSTATUS_UNSUPPORTED_COMPRESSION: u32 = 0xc000025f; +pub const SMB_NTSTATUS_INVALID_HW_PROFILE: u32 = 0xc0000260; +pub const SMB_NTSTATUS_INVALID_PLUGPLAY_DEVICE_PATH: u32 = 0xc0000261; +pub const SMB_NTSTATUS_DRIVER_ORDINAL_NOT_FOUND: u32 = 0xc0000262; +pub const SMB_NTSTATUS_DRIVER_ENTRYPOINT_NOT_FOUND: u32 = 0xc0000263; +pub const SMB_NTSTATUS_RESOURCE_NOT_OWNED: u32 = 0xc0000264; +pub const SMB_NTSTATUS_TOO_MANY_LINKS: u32 = 0xc0000265; +pub const SMB_NTSTATUS_QUOTA_LIST_INCONSISTENT: u32 = 0xc0000266; +pub const SMB_NTSTATUS_FILE_IS_OFFLINE: u32 = 0xc0000267; +pub const SMB_NTSTATUS_EVALUATION_EXPIRATION: u32 = 0xc0000268; +pub const SMB_NTSTATUS_ILLEGAL_DLL_RELOCATION: u32 = 0xc0000269; +pub const SMB_NTSTATUS_LICENSE_VIOLATION: u32 = 0xc000026a; +pub const SMB_NTSTATUS_DLL_INIT_FAILED_LOGOFF: u32 = 0xc000026b; +pub const SMB_NTSTATUS_DRIVER_UNABLE_TO_LOAD: u32 = 0xc000026c; +pub const SMB_NTSTATUS_DFS_UNAVAILABLE: u32 = 0xc000026d; +pub const SMB_NTSTATUS_VOLUME_DISMOUNTED: u32 = 0xc000026e; +pub const SMB_NTSTATUS_WX86_INTERNAL_ERROR: u32 = 0xc000026f; +pub const SMB_NTSTATUS_WX86_FLOAT_STACK_CHECK: u32 = 0xc0000270; +pub const SMB_NTSTATUS_VALIDATE_CONTINUE: u32 = 0xc0000271; +pub const SMB_NTSTATUS_NO_MATCH: u32 = 0xc0000272; +pub const SMB_NTSTATUS_NO_MORE_MATCHES: u32 = 0xc0000273; +pub const SMB_NTSTATUS_NOT_A_REPARSE_POINT: u32 = 0xc0000275; +pub const SMB_NTSTATUS_IO_REPARSE_TAG_INVALID: u32 = 0xc0000276; +pub const SMB_NTSTATUS_IO_REPARSE_TAG_MISMATCH: u32 = 0xc0000277; +pub const SMB_NTSTATUS_IO_REPARSE_DATA_INVALID: u32 = 0xc0000278; +pub const SMB_NTSTATUS_IO_REPARSE_TAG_NOT_HANDLED: u32 = 0xc0000279; +pub const SMB_NTSTATUS_REPARSE_POINT_NOT_RESOLVED: u32 = 0xc0000280; +pub const SMB_NTSTATUS_DIRECTORY_IS_A_REPARSE_POINT: u32 = 0xc0000281; +pub const SMB_NTSTATUS_RANGE_LIST_CONFLICT: u32 = 0xc0000282; +pub const SMB_NTSTATUS_SOURCE_ELEMENT_EMPTY: u32 = 0xc0000283; +pub const SMB_NTSTATUS_DESTINATION_ELEMENT_FULL: u32 = 0xc0000284; +pub const SMB_NTSTATUS_ILLEGAL_ELEMENT_ADDRESS: u32 = 0xc0000285; +pub const SMB_NTSTATUS_MAGAZINE_NOT_PRESENT: u32 = 0xc0000286; +pub const SMB_NTSTATUS_REINITIALIZATION_NEEDED: u32 = 0xc0000287; +pub const SMB_NTSTATUS_ENCRYPTION_FAILED: u32 = 0xc000028a; +pub const SMB_NTSTATUS_DECRYPTION_FAILED: u32 = 0xc000028b; +pub const SMB_NTSTATUS_RANGE_NOT_FOUND: u32 = 0xc000028c; +pub const SMB_NTSTATUS_NO_RECOVERY_POLICY: u32 = 0xc000028d; +pub const SMB_NTSTATUS_NO_EFS: u32 = 0xc000028e; +pub const SMB_NTSTATUS_WRONG_EFS: u32 = 0xc000028f; +pub const SMB_NTSTATUS_NO_USER_KEYS: u32 = 0xc0000290; +pub const SMB_NTSTATUS_FILE_NOT_ENCRYPTED: u32 = 0xc0000291; +pub const SMB_NTSTATUS_NOT_EXPORT_FORMAT: u32 = 0xc0000292; +pub const SMB_NTSTATUS_FILE_ENCRYPTED: u32 = 0xc0000293; +pub const SMB_NTSTATUS_WMI_GUID_NOT_FOUND: u32 = 0xc0000295; +pub const SMB_NTSTATUS_WMI_INSTANCE_NOT_FOUND: u32 = 0xc0000296; +pub const SMB_NTSTATUS_WMI_ITEMID_NOT_FOUND: u32 = 0xc0000297; +pub const SMB_NTSTATUS_WMI_TRY_AGAIN: u32 = 0xc0000298; +pub const SMB_NTSTATUS_SHARED_POLICY: u32 = 0xc0000299; +pub const SMB_NTSTATUS_POLICY_OBJECT_NOT_FOUND: u32 = 0xc000029a; +pub const SMB_NTSTATUS_POLICY_ONLY_IN_DS: u32 = 0xc000029b; +pub const SMB_NTSTATUS_VOLUME_NOT_UPGRADED: u32 = 0xc000029c; +pub const SMB_NTSTATUS_REMOTE_STORAGE_NOT_ACTIVE: u32 = 0xc000029d; +pub const SMB_NTSTATUS_REMOTE_STORAGE_MEDIA_ERROR: u32 = 0xc000029e; +pub const SMB_NTSTATUS_NO_TRACKING_SERVICE: u32 = 0xc000029f; +pub const SMB_NTSTATUS_SERVER_SID_MISMATCH: u32 = 0xc00002a0; +pub const SMB_NTSTATUS_DS_NO_ATTRIBUTE_OR_VALUE: u32 = 0xc00002a1; +pub const SMB_NTSTATUS_DS_INVALID_ATTRIBUTE_SYNTAX: u32 = 0xc00002a2; +pub const SMB_NTSTATUS_DS_ATTRIBUTE_TYPE_UNDEFINED: u32 = 0xc00002a3; +pub const SMB_NTSTATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS: u32 = 0xc00002a4; +pub const SMB_NTSTATUS_DS_BUSY: u32 = 0xc00002a5; +pub const SMB_NTSTATUS_DS_UNAVAILABLE: u32 = 0xc00002a6; +pub const SMB_NTSTATUS_DS_NO_RIDS_ALLOCATED: u32 = 0xc00002a7; +pub const SMB_NTSTATUS_DS_NO_MORE_RIDS: u32 = 0xc00002a8; +pub const SMB_NTSTATUS_DS_INCORRECT_ROLE_OWNER: u32 = 0xc00002a9; +pub const SMB_NTSTATUS_DS_RIDMGR_INIT_ERROR: u32 = 0xc00002aa; +pub const SMB_NTSTATUS_DS_OBJ_CLASS_VIOLATION: u32 = 0xc00002ab; +pub const SMB_NTSTATUS_DS_CANT_ON_NON_LEAF: u32 = 0xc00002ac; +pub const SMB_NTSTATUS_DS_CANT_ON_RDN: u32 = 0xc00002ad; +pub const SMB_NTSTATUS_DS_CANT_MOD_OBJ_CLASS: u32 = 0xc00002ae; +pub const SMB_NTSTATUS_DS_CROSS_DOM_MOVE_FAILED: u32 = 0xc00002af; +pub const SMB_NTSTATUS_DS_GC_NOT_AVAILABLE: u32 = 0xc00002b0; +pub const SMB_NTSTATUS_DIRECTORY_SERVICE_REQUIRED: u32 = 0xc00002b1; +pub const SMB_NTSTATUS_REPARSE_ATTRIBUTE_CONFLICT: u32 = 0xc00002b2; +pub const SMB_NTSTATUS_CANT_ENABLE_DENY_ONLY: u32 = 0xc00002b3; +pub const SMB_NTSTATUS_FLOAT_MULTIPLE_FAULTS: u32 = 0xc00002b4; +pub const SMB_NTSTATUS_FLOAT_MULTIPLE_TRAPS: u32 = 0xc00002b5; +pub const SMB_NTSTATUS_DEVICE_REMOVED: u32 = 0xc00002b6; +pub const SMB_NTSTATUS_JOURNAL_DELETE_IN_PROGRESS: u32 = 0xc00002b7; +pub const SMB_NTSTATUS_JOURNAL_NOT_ACTIVE: u32 = 0xc00002b8; +pub const SMB_NTSTATUS_NOINTERFACE: u32 = 0xc00002b9; +pub const SMB_NTSTATUS_DS_ADMIN_LIMIT_EXCEEDED: u32 = 0xc00002c1; +pub const SMB_NTSTATUS_DRIVER_FAILED_SLEEP: u32 = 0xc00002c2; +pub const SMB_NTSTATUS_MUTUAL_AUTHENTICATION_FAILED: u32 = 0xc00002c3; +pub const SMB_NTSTATUS_CORRUPT_SYSTEM_FILE: u32 = 0xc00002c4; +pub const SMB_NTSTATUS_DATATYPE_MISALIGNMENT_ERROR: u32 = 0xc00002c5; +pub const SMB_NTSTATUS_WMI_READ_ONLY: u32 = 0xc00002c6; +pub const SMB_NTSTATUS_WMI_SET_FAILURE: u32 = 0xc00002c7; +pub const SMB_NTSTATUS_COMMITMENT_MINIMUM: u32 = 0xc00002c8; +pub const SMB_NTSTATUS_REG_NAT_CONSUMPTION: u32 = 0xc00002c9; +pub const SMB_NTSTATUS_TRANSPORT_FULL: u32 = 0xc00002ca; +pub const SMB_NTSTATUS_DS_SAM_INIT_FAILURE: u32 = 0xc00002cb; +pub const SMB_NTSTATUS_ONLY_IF_CONNECTED: u32 = 0xc00002cc; +pub const SMB_NTSTATUS_DS_SENSITIVE_GROUP_VIOLATION: u32 = 0xc00002cd; +pub const SMB_NTSTATUS_PNP_RESTART_ENUMERATION: u32 = 0xc00002ce; +pub const SMB_NTSTATUS_JOURNAL_ENTRY_DELETED: u32 = 0xc00002cf; +pub const SMB_NTSTATUS_DS_CANT_MOD_PRIMARYGROUPID: u32 = 0xc00002d0; +pub const SMB_NTSTATUS_SYSTEM_IMAGE_BAD_SIGNATURE: u32 = 0xc00002d1; +pub const SMB_NTSTATUS_PNP_REBOOT_REQUIRED: u32 = 0xc00002d2; +pub const SMB_NTSTATUS_POWER_STATE_INVALID: u32 = 0xc00002d3; +pub const SMB_NTSTATUS_DS_INVALID_GROUP_TYPE: u32 = 0xc00002d4; +pub const SMB_NTSTATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: u32 = 0xc00002d5; +pub const SMB_NTSTATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: u32 = 0xc00002d6; +pub const SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: u32 = 0xc00002d7; +pub const SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: u32 = 0xc00002d8; +pub const SMB_NTSTATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: u32 = 0xc00002d9; +pub const SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: u32 = 0xc00002da; +pub const SMB_NTSTATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: u32 = 0xc00002db; +pub const SMB_NTSTATUS_DS_HAVE_PRIMARY_MEMBERS: u32 = 0xc00002dc; +pub const SMB_NTSTATUS_WMI_NOT_SUPPORTED: u32 = 0xc00002dd; +pub const SMB_NTSTATUS_INSUFFICIENT_POWER: u32 = 0xc00002de; +pub const SMB_NTSTATUS_SAM_NEED_BOOTKEY_PASSWORD: u32 = 0xc00002df; +pub const SMB_NTSTATUS_SAM_NEED_BOOTKEY_FLOPPY: u32 = 0xc00002e0; +pub const SMB_NTSTATUS_DS_CANT_START: u32 = 0xc00002e1; +pub const SMB_NTSTATUS_DS_INIT_FAILURE: u32 = 0xc00002e2; +pub const SMB_NTSTATUS_SAM_INIT_FAILURE: u32 = 0xc00002e3; +pub const SMB_NTSTATUS_DS_GC_REQUIRED: u32 = 0xc00002e4; +pub const SMB_NTSTATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: u32 = 0xc00002e5; +pub const SMB_NTSTATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS: u32 = 0xc00002e6; +pub const SMB_NTSTATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: u32 = 0xc00002e7; +pub const SMB_NTSTATUS_CURRENT_DOMAIN_NOT_ALLOWED: u32 = 0xc00002e9; +pub const SMB_NTSTATUS_CANNOT_MAKE: u32 = 0xc00002ea; +pub const SMB_NTSTATUS_SYSTEM_SHUTDOWN: u32 = 0xc00002eb; +pub const SMB_NTSTATUS_DS_INIT_FAILURE_CONSOLE: u32 = 0xc00002ec; +pub const SMB_NTSTATUS_DS_SAM_INIT_FAILURE_CONSOLE: u32 = 0xc00002ed; +pub const SMB_NTSTATUS_UNFINISHED_CONTEXT_DELETED: u32 = 0xc00002ee; +pub const SMB_NTSTATUS_NO_TGT_REPLY: u32 = 0xc00002ef; +pub const SMB_NTSTATUS_OBJECTID_NOT_FOUND: u32 = 0xc00002f0; +pub const SMB_NTSTATUS_NO_IP_ADDRESSES: u32 = 0xc00002f1; +pub const SMB_NTSTATUS_WRONG_CREDENTIAL_HANDLE: u32 = 0xc00002f2; +pub const SMB_NTSTATUS_CRYPTO_SYSTEM_INVALID: u32 = 0xc00002f3; +pub const SMB_NTSTATUS_MAX_REFERRALS_EXCEEDED: u32 = 0xc00002f4; +pub const SMB_NTSTATUS_MUST_BE_KDC: u32 = 0xc00002f5; +pub const SMB_NTSTATUS_STRONG_CRYPTO_NOT_SUPPORTED: u32 = 0xc00002f6; +pub const SMB_NTSTATUS_TOO_MANY_PRINCIPALS: u32 = 0xc00002f7; +pub const SMB_NTSTATUS_NO_PA_DATA: u32 = 0xc00002f8; +pub const SMB_NTSTATUS_PKINIT_NAME_MISMATCH: u32 = 0xc00002f9; +pub const SMB_NTSTATUS_SMARTCARD_LOGON_REQUIRED: u32 = 0xc00002fa; +pub const SMB_NTSTATUS_KDC_INVALID_REQUEST: u32 = 0xc00002fb; +pub const SMB_NTSTATUS_KDC_UNABLE_TO_REFER: u32 = 0xc00002fc; +pub const SMB_NTSTATUS_KDC_UNKNOWN_ETYPE: u32 = 0xc00002fd; +pub const SMB_NTSTATUS_SHUTDOWN_IN_PROGRESS: u32 = 0xc00002fe; +pub const SMB_NTSTATUS_SERVER_SHUTDOWN_IN_PROGRESS: u32 = 0xc00002ff; +pub const SMB_NTSTATUS_NOT_SUPPORTED_ON_SBS: u32 = 0xc0000300; +pub const SMB_NTSTATUS_WMI_GUID_DISCONNECTED: u32 = 0xc0000301; +pub const SMB_NTSTATUS_WMI_ALREADY_DISABLED: u32 = 0xc0000302; +pub const SMB_NTSTATUS_WMI_ALREADY_ENABLED: u32 = 0xc0000303; +pub const SMB_NTSTATUS_MFT_TOO_FRAGMENTED: u32 = 0xc0000304; +pub const SMB_NTSTATUS_COPY_PROTECTION_FAILURE: u32 = 0xc0000305; +pub const SMB_NTSTATUS_CSS_AUTHENTICATION_FAILURE: u32 = 0xc0000306; +pub const SMB_NTSTATUS_CSS_KEY_NOT_PRESENT: u32 = 0xc0000307; +pub const SMB_NTSTATUS_CSS_KEY_NOT_ESTABLISHED: u32 = 0xc0000308; +pub const SMB_NTSTATUS_CSS_SCRAMBLED_SECTOR: u32 = 0xc0000309; +pub const SMB_NTSTATUS_CSS_REGION_MISMATCH: u32 = 0xc000030a; +pub const SMB_NTSTATUS_CSS_RESETS_EXHAUSTED: u32 = 0xc000030b; +pub const SMB_NTSTATUS_PKINIT_FAILURE: u32 = 0xc0000320; +pub const SMB_NTSTATUS_SMARTCARD_SUBSYSTEM_FAILURE: u32 = 0xc0000321; +pub const SMB_NTSTATUS_NO_KERB_KEY: u32 = 0xc0000322; +pub const SMB_NTSTATUS_HOST_DOWN: u32 = 0xc0000350; +pub const SMB_NTSTATUS_UNSUPPORTED_PREAUTH: u32 = 0xc0000351; +pub const SMB_NTSTATUS_EFS_ALG_BLOB_TOO_BIG: u32 = 0xc0000352; +pub const SMB_NTSTATUS_PORT_NOT_SET: u32 = 0xc0000353; +pub const SMB_NTSTATUS_DEBUGGER_INACTIVE: u32 = 0xc0000354; +pub const SMB_NTSTATUS_DS_VERSION_CHECK_FAILURE: u32 = 0xc0000355; +pub const SMB_NTSTATUS_AUDITING_DISABLED: u32 = 0xc0000356; +pub const SMB_NTSTATUS_PRENT4_MACHINE_ACCOUNT: u32 = 0xc0000357; +pub const SMB_NTSTATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: u32 = 0xc0000358; +pub const SMB_NTSTATUS_INVALID_IMAGE_WIN_32: u32 = 0xc0000359; +pub const SMB_NTSTATUS_INVALID_IMAGE_WIN_64: u32 = 0xc000035a; +pub const SMB_NTSTATUS_BAD_BINDINGS: u32 = 0xc000035b; +pub const SMB_NTSTATUS_NETWORK_SESSION_EXPIRED: u32 = 0xc000035c; +pub const SMB_NTSTATUS_APPHELP_BLOCK: u32 = 0xc000035d; +pub const SMB_NTSTATUS_ALL_SIDS_FILTERED: u32 = 0xc000035e; +pub const SMB_NTSTATUS_NOT_SAFE_MODE_DRIVER: u32 = 0xc000035f; +pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT: u32 = 0xc0000361; +pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PATH: u32 = 0xc0000362; +pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER: u32 = 0xc0000363; +pub const SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_OTHER: u32 = 0xc0000364; +pub const SMB_NTSTATUS_FAILED_DRIVER_ENTRY: u32 = 0xc0000365; +pub const SMB_NTSTATUS_DEVICE_ENUMERATION_ERROR: u32 = 0xc0000366; +pub const SMB_NTSTATUS_MOUNT_POINT_NOT_RESOLVED: u32 = 0xc0000368; +pub const SMB_NTSTATUS_INVALID_DEVICE_OBJECT_PARAMETER: u32 = 0xc0000369; +pub const SMB_NTSTATUS_MCA_OCCURED: u32 = 0xc000036a; +pub const SMB_NTSTATUS_DRIVER_BLOCKED_CRITICAL: u32 = 0xc000036b; +pub const SMB_NTSTATUS_DRIVER_BLOCKED: u32 = 0xc000036c; +pub const SMB_NTSTATUS_DRIVER_DATABASE_ERROR: u32 = 0xc000036d; +pub const SMB_NTSTATUS_SYSTEM_HIVE_TOO_LARGE: u32 = 0xc000036e; +pub const SMB_NTSTATUS_INVALID_IMPORT_OF_NON_DLL: u32 = 0xc000036f; +pub const SMB_NTSTATUS_NO_SECRETS: u32 = 0xc0000371; +pub const SMB_NTSTATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: u32 = 0xc0000372; +pub const SMB_NTSTATUS_FAILED_STACK_SWITCH: u32 = 0xc0000373; +pub const SMB_NTSTATUS_HEAP_CORRUPTION: u32 = 0xc0000374; +pub const SMB_NTSTATUS_SMARTCARD_WRONG_PIN: u32 = 0xc0000380; +pub const SMB_NTSTATUS_SMARTCARD_CARD_BLOCKED: u32 = 0xc0000381; +pub const SMB_NTSTATUS_SMARTCARD_CARD_NOT_AUTHENTICATED: u32 = 0xc0000382; +pub const SMB_NTSTATUS_SMARTCARD_NO_CARD: u32 = 0xc0000383; +pub const SMB_NTSTATUS_SMARTCARD_NO_KEY_CONTAINER: u32 = 0xc0000384; +pub const SMB_NTSTATUS_SMARTCARD_NO_CERTIFICATE: u32 = 0xc0000385; +pub const SMB_NTSTATUS_SMARTCARD_NO_KEYSET: u32 = 0xc0000386; +pub const SMB_NTSTATUS_SMARTCARD_IO_ERROR: u32 = 0xc0000387; +pub const SMB_NTSTATUS_DOWNGRADE_DETECTED: u32 = 0xc0000388; +pub const SMB_NTSTATUS_SMARTCARD_CERT_REVOKED: u32 = 0xc0000389; +pub const SMB_NTSTATUS_ISSUING_CA_UNTRUSTED: u32 = 0xc000038a; +pub const SMB_NTSTATUS_REVOCATION_OFFLINE_C: u32 = 0xc000038b; +pub const SMB_NTSTATUS_PKINIT_CLIENT_FAILURE: u32 = 0xc000038c; +pub const SMB_NTSTATUS_SMARTCARD_CERT_EXPIRED: u32 = 0xc000038d; +pub const SMB_NTSTATUS_DRIVER_FAILED_PRIOR_UNLOAD: u32 = 0xc000038e; +pub const SMB_NTSTATUS_SMARTCARD_SILENT_CONTEXT: u32 = 0xc000038f; +pub const SMB_NTSTATUS_PER_USER_TRUST_QUOTA_EXCEEDED: u32 = 0xc0000401; +pub const SMB_NTSTATUS_ALL_USER_TRUST_QUOTA_EXCEEDED: u32 = 0xc0000402; +pub const SMB_NTSTATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED: u32 = 0xc0000403; +pub const SMB_NTSTATUS_DS_NAME_NOT_UNIQUE: u32 = 0xc0000404; +pub const SMB_NTSTATUS_DS_DUPLICATE_ID_FOUND: u32 = 0xc0000405; +pub const SMB_NTSTATUS_DS_GROUP_CONVERSION_ERROR: u32 = 0xc0000406; +pub const SMB_NTSTATUS_VOLSNAP_PREPARE_HIBERNATE: u32 = 0xc0000407; +pub const SMB_NTSTATUS_USER2USER_REQUIRED: u32 = 0xc0000408; +pub const SMB_NTSTATUS_STACK_BUFFER_OVERRUN: u32 = 0xc0000409; +pub const SMB_NTSTATUS_NO_S4U_PROT_SUPPORT: u32 = 0xc000040a; +pub const SMB_NTSTATUS_CROSSREALM_DELEGATION_FAILURE: u32 = 0xc000040b; +pub const SMB_NTSTATUS_REVOCATION_OFFLINE_KDC: u32 = 0xc000040c; +pub const SMB_NTSTATUS_ISSUING_CA_UNTRUSTED_KDC: u32 = 0xc000040d; +pub const SMB_NTSTATUS_KDC_CERT_EXPIRED: u32 = 0xc000040e; +pub const SMB_NTSTATUS_KDC_CERT_REVOKED: u32 = 0xc000040f; +pub const SMB_NTSTATUS_PARAMETER_QUOTA_EXCEEDED: u32 = 0xc0000410; +pub const SMB_NTSTATUS_HIBERNATION_FAILURE: u32 = 0xc0000411; +pub const SMB_NTSTATUS_DELAY_LOAD_FAILED: u32 = 0xc0000412; +pub const SMB_NTSTATUS_AUTHENTICATION_FIREWALL_FAILED: u32 = 0xc0000413; +pub const SMB_NTSTATUS_VDM_DISALLOWED: u32 = 0xc0000414; +pub const SMB_NTSTATUS_HUNG_DISPLAY_DRIVER_THREAD: u32 = 0xc0000415; +pub const SMB_NTSTATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: u32 = 0xc0000416; +pub const SMB_NTSTATUS_INVALID_CRUNTIME_PARAMETER: u32 = 0xc0000417; +pub const SMB_NTSTATUS_NTLM_BLOCKED: u32 = 0xc0000418; +pub const SMB_NTSTATUS_DS_SRC_SID_EXISTS_IN_FOREST: u32 = 0xc0000419; +pub const SMB_NTSTATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST: u32 = 0xc000041a; +pub const SMB_NTSTATUS_DS_FLAT_NAME_EXISTS_IN_FOREST: u32 = 0xc000041b; +pub const SMB_NTSTATUS_INVALID_USER_PRINCIPAL_NAME: u32 = 0xc000041c; +pub const SMB_NTSTATUS_ASSERTION_FAILURE: u32 = 0xc0000420; +pub const SMB_NTSTATUS_VERIFIER_STOP: u32 = 0xc0000421; +pub const SMB_NTSTATUS_CALLBACK_POP_STACK: u32 = 0xc0000423; +pub const SMB_NTSTATUS_INCOMPATIBLE_DRIVER_BLOCKED: u32 = 0xc0000424; +pub const SMB_NTSTATUS_HIVE_UNLOADED: u32 = 0xc0000425; +pub const SMB_NTSTATUS_COMPRESSION_DISABLED: u32 = 0xc0000426; +pub const SMB_NTSTATUS_FILE_SYSTEM_LIMITATION: u32 = 0xc0000427; +pub const SMB_NTSTATUS_INVALID_IMAGE_HASH: u32 = 0xc0000428; +pub const SMB_NTSTATUS_NOT_CAPABLE: u32 = 0xc0000429; +pub const SMB_NTSTATUS_REQUEST_OUT_OF_SEQUENCE: u32 = 0xc000042a; +pub const SMB_NTSTATUS_IMPLEMENTATION_LIMIT: u32 = 0xc000042b; +pub const SMB_NTSTATUS_ELEVATION_REQUIRED: u32 = 0xc000042c; +pub const SMB_NTSTATUS_NO_SECURITY_CONTEXT: u32 = 0xc000042d; +pub const SMB_NTSTATUS_PKU2U_CERT_FAILURE: u32 = 0xc000042e; +pub const SMB_NTSTATUS_BEYOND_VDL: u32 = 0xc0000432; +pub const SMB_NTSTATUS_ENCOUNTERED_WRITE_IN_PROGRESS: u32 = 0xc0000433; +pub const SMB_NTSTATUS_PTE_CHANGED: u32 = 0xc0000434; +pub const SMB_NTSTATUS_PURGE_FAILED: u32 = 0xc0000435; +pub const SMB_NTSTATUS_CRED_REQUIRES_CONFIRMATION: u32 = 0xc0000440; +pub const SMB_NTSTATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: u32 = 0xc0000441; +pub const SMB_NTSTATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER: u32 = 0xc0000442; +pub const SMB_NTSTATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: u32 = 0xc0000443; +pub const SMB_NTSTATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: u32 = 0xc0000444; +pub const SMB_NTSTATUS_CS_ENCRYPTION_FILE_NOT_CSE: u32 = 0xc0000445; +pub const SMB_NTSTATUS_INVALID_LABEL: u32 = 0xc0000446; +pub const SMB_NTSTATUS_DRIVER_PROCESS_TERMINATED: u32 = 0xc0000450; +pub const SMB_NTSTATUS_AMBIGUOUS_SYSTEM_DEVICE: u32 = 0xc0000451; +pub const SMB_NTSTATUS_SYSTEM_DEVICE_NOT_FOUND: u32 = 0xc0000452; +pub const SMB_NTSTATUS_RESTART_BOOT_APPLICATION: u32 = 0xc0000453; +pub const SMB_NTSTATUS_INSUFFICIENT_NVRAM_RESOURCES: u32 = 0xc0000454; +pub const SMB_NTSTATUS_NO_RANGES_PROCESSED: u32 = 0xc0000460; +pub const SMB_NTSTATUS_DEVICE_FEATURE_NOT_SUPPORTED: u32 = 0xc0000463; +pub const SMB_NTSTATUS_DEVICE_UNREACHABLE: u32 = 0xc0000464; +pub const SMB_NTSTATUS_INVALID_TOKEN: u32 = 0xc0000465; +pub const SMB_NTSTATUS_SERVER_UNAVAILABLE: u32 = 0xc0000466; +pub const SMB_NTSTATUS_INVALID_TASK_NAME: u32 = 0xc0000500; +pub const SMB_NTSTATUS_INVALID_TASK_INDEX: u32 = 0xc0000501; +pub const SMB_NTSTATUS_THREAD_ALREADY_IN_TASK: u32 = 0xc0000502; +pub const SMB_NTSTATUS_CALLBACK_BYPASS: u32 = 0xc0000503; +pub const SMB_NTSTATUS_FAIL_FAST_EXCEPTION: u32 = 0xc0000602; +pub const SMB_NTSTATUS_IMAGE_CERT_REVOKED: u32 = 0xc0000603; +pub const SMB_NTSTATUS_PORT_CLOSED: u32 = 0xc0000700; +pub const SMB_NTSTATUS_MESSAGE_LOST: u32 = 0xc0000701; +pub const SMB_NTSTATUS_INVALID_MESSAGE: u32 = 0xc0000702; +pub const SMB_NTSTATUS_REQUEST_CANCELED: u32 = 0xc0000703; +pub const SMB_NTSTATUS_RECURSIVE_DISPATCH: u32 = 0xc0000704; +pub const SMB_NTSTATUS_LPC_RECEIVE_BUFFER_EXPECTED: u32 = 0xc0000705; +pub const SMB_NTSTATUS_LPC_INVALID_CONNECTION_USAGE: u32 = 0xc0000706; +pub const SMB_NTSTATUS_LPC_REQUESTS_NOT_ALLOWED: u32 = 0xc0000707; +pub const SMB_NTSTATUS_RESOURCE_IN_USE: u32 = 0xc0000708; +pub const SMB_NTSTATUS_HARDWARE_MEMORY_ERROR: u32 = 0xc0000709; +pub const SMB_NTSTATUS_THREADPOOL_HANDLE_EXCEPTION: u32 = 0xc000070a; +pub const SMB_NTSTATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED: u32 = 0xc000070b; +pub const SMB_NTSTATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED: u32 = 0xc000070c; +pub const SMB_NTSTATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED: u32 = 0xc000070d; +pub const SMB_NTSTATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED: u32 = 0xc000070e; +pub const SMB_NTSTATUS_THREADPOOL_RELEASED_DURING_OPERATION: u32 = 0xc000070f; +pub const SMB_NTSTATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING: u32 = 0xc0000710; +pub const SMB_NTSTATUS_APC_RETURNED_WHILE_IMPERSONATING: u32 = 0xc0000711; +pub const SMB_NTSTATUS_PROCESS_IS_PROTECTED: u32 = 0xc0000712; +pub const SMB_NTSTATUS_MCA_EXCEPTION: u32 = 0xc0000713; +pub const SMB_NTSTATUS_CERTIFICATE_MAPPING_NOT_UNIQUE: u32 = 0xc0000714; +pub const SMB_NTSTATUS_SYMLINK_CLASS_DISABLED: u32 = 0xc0000715; +pub const SMB_NTSTATUS_INVALID_IDN_NORMALIZATION: u32 = 0xc0000716; +pub const SMB_NTSTATUS_NO_UNICODE_TRANSLATION: u32 = 0xc0000717; +pub const SMB_NTSTATUS_ALREADY_REGISTERED: u32 = 0xc0000718; +pub const SMB_NTSTATUS_CONTEXT_MISMATCH: u32 = 0xc0000719; +pub const SMB_NTSTATUS_PORT_ALREADY_HAS_COMPLETION_LIST: u32 = 0xc000071a; +pub const SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_PRIORITY: u32 = 0xc000071b; +pub const SMB_NTSTATUS_INVALID_THREAD: u32 = 0xc000071c; +pub const SMB_NTSTATUS_CALLBACK_RETURNED_TRANSACTION: u32 = 0xc000071d; +pub const SMB_NTSTATUS_CALLBACK_RETURNED_LDR_LOCK: u32 = 0xc000071e; +pub const SMB_NTSTATUS_CALLBACK_RETURNED_LANG: u32 = 0xc000071f; +pub const SMB_NTSTATUS_CALLBACK_RETURNED_PRI_BACK: u32 = 0xc0000720; +pub const SMB_NTSTATUS_DISK_REPAIR_DISABLED: u32 = 0xc0000800; +pub const SMB_NTSTATUS_DS_DOMAIN_RENAME_IN_PROGRESS: u32 = 0xc0000801; +pub const SMB_NTSTATUS_DISK_QUOTA_EXCEEDED: u32 = 0xc0000802; +pub const SMB_NTSTATUS_CONTENT_BLOCKED: u32 = 0xc0000804; +pub const SMB_NTSTATUS_BAD_CLUSTERS: u32 = 0xc0000805; +pub const SMB_NTSTATUS_VOLUME_DIRTY: u32 = 0xc0000806; +pub const SMB_NTSTATUS_FILE_CHECKED_OUT: u32 = 0xc0000901; +pub const SMB_NTSTATUS_CHECKOUT_REQUIRED: u32 = 0xc0000902; +pub const SMB_NTSTATUS_BAD_FILE_TYPE: u32 = 0xc0000903; +pub const SMB_NTSTATUS_FILE_TOO_LARGE: u32 = 0xc0000904; +pub const SMB_NTSTATUS_FORMS_AUTH_REQUIRED: u32 = 0xc0000905; +pub const SMB_NTSTATUS_VIRUS_INFECTED: u32 = 0xc0000906; +pub const SMB_NTSTATUS_VIRUS_DELETED: u32 = 0xc0000907; +pub const SMB_NTSTATUS_BAD_MCFG_TABLE: u32 = 0xc0000908; +pub const SMB_NTSTATUS_CANNOT_BREAK_OPLOCK: u32 = 0xc0000909; +pub const SMB_NTSTATUS_WOW_ASSERTION: u32 = 0xc0009898; +pub const SMB_NTSTATUS_INVALID_SIGNATURE: u32 = 0xc000a000; +pub const SMB_NTSTATUS_HMAC_NOT_SUPPORTED: u32 = 0xc000a001; +pub const SMB_NTSTATUS_IPSEC_QUEUE_OVERFLOW: u32 = 0xc000a010; +pub const SMB_NTSTATUS_ND_QUEUE_OVERFLOW: u32 = 0xc000a011; +pub const SMB_NTSTATUS_HOPLIMIT_EXCEEDED: u32 = 0xc000a012; +pub const SMB_NTSTATUS_PROTOCOL_NOT_SUPPORTED: u32 = 0xc000a013; +pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: u32 = 0xc000a080; +pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: u32 = 0xc000a081; +pub const SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: u32 = 0xc000a082; +pub const SMB_NTSTATUS_XML_PARSE_ERROR: u32 = 0xc000a083; +pub const SMB_NTSTATUS_XMLDSIG_ERROR: u32 = 0xc000a084; +pub const SMB_NTSTATUS_WRONG_COMPARTMENT: u32 = 0xc000a085; +pub const SMB_NTSTATUS_AUTHIP_FAILURE: u32 = 0xc000a086; +pub const SMB_NTSTATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: u32 = 0xc000a087; +pub const SMB_NTSTATUS_DS_OID_NOT_FOUND: u32 = 0xc000a088; +pub const SMB_NTSTATUS_HASH_NOT_SUPPORTED: u32 = 0xc000a100; +pub const SMB_NTSTATUS_HASH_NOT_PRESENT: u32 = 0xc000a101; +pub const SMB_NTSTATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED: u32 = 0xc000a2a1; +pub const SMB_NTSTATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: u32 = 0xc000a2a2; +pub const SMB_NTSTATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED: u32 = 0xc000a2a3; +pub const SMB_NTSTATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: u32 = 0xc000a2a4; +pub const SMB_NTDBG_NO_STATE_CHANGE: u32 = 0xc0010001; +pub const SMB_NTDBG_APP_NOT_IDLE: u32 = 0xc0010002; +pub const SMB_NTRPC_NT_INVALID_STRING_BINDING: u32 = 0xc0020001; +pub const SMB_NTRPC_NT_WRONG_KIND_OF_BINDING: u32 = 0xc0020002; +pub const SMB_NTRPC_NT_INVALID_BINDING: u32 = 0xc0020003; +pub const SMB_NTRPC_NT_PROTSEQ_NOT_SUPPORTED: u32 = 0xc0020004; +pub const SMB_NTRPC_NT_INVALID_RPC_PROTSEQ: u32 = 0xc0020005; +pub const SMB_NTRPC_NT_INVALID_STRING_UUID: u32 = 0xc0020006; +pub const SMB_NTRPC_NT_INVALID_ENDPOINT_FORMAT: u32 = 0xc0020007; +pub const SMB_NTRPC_NT_INVALID_NET_ADDR: u32 = 0xc0020008; +pub const SMB_NTRPC_NT_NO_ENDPOINT_FOUND: u32 = 0xc0020009; +pub const SMB_NTRPC_NT_INVALID_TIMEOUT: u32 = 0xc002000a; +pub const SMB_NTRPC_NT_OBJECT_NOT_FOUND: u32 = 0xc002000b; +pub const SMB_NTRPC_NT_ALREADY_REGISTERED: u32 = 0xc002000c; +pub const SMB_NTRPC_NT_TYPE_ALREADY_REGISTERED: u32 = 0xc002000d; +pub const SMB_NTRPC_NT_ALREADY_LISTENING: u32 = 0xc002000e; +pub const SMB_NTRPC_NT_NO_PROTSEQS_REGISTERED: u32 = 0xc002000f; +pub const SMB_NTRPC_NT_NOT_LISTENING: u32 = 0xc0020010; +pub const SMB_NTRPC_NT_UNKNOWN_MGR_TYPE: u32 = 0xc0020011; +pub const SMB_NTRPC_NT_UNKNOWN_IF: u32 = 0xc0020012; +pub const SMB_NTRPC_NT_NO_BINDINGS: u32 = 0xc0020013; +pub const SMB_NTRPC_NT_NO_PROTSEQS: u32 = 0xc0020014; +pub const SMB_NTRPC_NT_CANT_CREATE_ENDPOINT: u32 = 0xc0020015; +pub const SMB_NTRPC_NT_OUT_OF_RESOURCES: u32 = 0xc0020016; +pub const SMB_NTRPC_NT_SERVER_UNAVAILABLE: u32 = 0xc0020017; +pub const SMB_NTRPC_NT_SERVER_TOO_BUSY: u32 = 0xc0020018; +pub const SMB_NTRPC_NT_INVALID_NETWORK_OPTIONS: u32 = 0xc0020019; +pub const SMB_NTRPC_NT_NO_CALL_ACTIVE: u32 = 0xc002001a; +pub const SMB_NTRPC_NT_CALL_FAILED: u32 = 0xc002001b; +pub const SMB_NTRPC_NT_CALL_FAILED_DNE: u32 = 0xc002001c; +pub const SMB_NTRPC_NT_PROTOCOL_ERROR: u32 = 0xc002001d; +pub const SMB_NTRPC_NT_UNSUPPORTED_TRANS_SYN: u32 = 0xc002001f; +pub const SMB_NTRPC_NT_UNSUPPORTED_TYPE: u32 = 0xc0020021; +pub const SMB_NTRPC_NT_INVALID_TAG: u32 = 0xc0020022; +pub const SMB_NTRPC_NT_INVALID_BOUND: u32 = 0xc0020023; +pub const SMB_NTRPC_NT_NO_ENTRY_NAME: u32 = 0xc0020024; +pub const SMB_NTRPC_NT_INVALID_NAME_SYNTAX: u32 = 0xc0020025; +pub const SMB_NTRPC_NT_UNSUPPORTED_NAME_SYNTAX: u32 = 0xc0020026; +pub const SMB_NTRPC_NT_UUID_NO_ADDRESS: u32 = 0xc0020028; +pub const SMB_NTRPC_NT_DUPLICATE_ENDPOINT: u32 = 0xc0020029; +pub const SMB_NTRPC_NT_UNKNOWN_AUTHN_TYPE: u32 = 0xc002002a; +pub const SMB_NTRPC_NT_MAX_CALLS_TOO_SMALL: u32 = 0xc002002b; +pub const SMB_NTRPC_NT_STRING_TOO_LONG: u32 = 0xc002002c; +pub const SMB_NTRPC_NT_PROTSEQ_NOT_FOUND: u32 = 0xc002002d; +pub const SMB_NTRPC_NT_PROCNUM_OUT_OF_RANGE: u32 = 0xc002002e; +pub const SMB_NTRPC_NT_BINDING_HAS_NO_AUTH: u32 = 0xc002002f; +pub const SMB_NTRPC_NT_UNKNOWN_AUTHN_SERVICE: u32 = 0xc0020030; +pub const SMB_NTRPC_NT_UNKNOWN_AUTHN_LEVEL: u32 = 0xc0020031; +pub const SMB_NTRPC_NT_INVALID_AUTH_IDENTITY: u32 = 0xc0020032; +pub const SMB_NTRPC_NT_UNKNOWN_AUTHZ_SERVICE: u32 = 0xc0020033; +pub const SMB_NTEPT_NT_INVALID_ENTRY: u32 = 0xc0020034; +pub const SMB_NTEPT_NT_CANT_PERFORM_OP: u32 = 0xc0020035; +pub const SMB_NTEPT_NT_NOT_REGISTERED: u32 = 0xc0020036; +pub const SMB_NTRPC_NT_NOTHING_TO_EXPORT: u32 = 0xc0020037; +pub const SMB_NTRPC_NT_INCOMPLETE_NAME: u32 = 0xc0020038; +pub const SMB_NTRPC_NT_INVALID_VERS_OPTION: u32 = 0xc0020039; +pub const SMB_NTRPC_NT_NO_MORE_MEMBERS: u32 = 0xc002003a; +pub const SMB_NTRPC_NT_NOT_ALL_OBJS_UNEXPORTED: u32 = 0xc002003b; +pub const SMB_NTRPC_NT_INTERFACE_NOT_FOUND: u32 = 0xc002003c; +pub const SMB_NTRPC_NT_ENTRY_ALREADY_EXISTS: u32 = 0xc002003d; +pub const SMB_NTRPC_NT_ENTRY_NOT_FOUND: u32 = 0xc002003e; +pub const SMB_NTRPC_NT_NAME_SERVICE_UNAVAILABLE: u32 = 0xc002003f; +pub const SMB_NTRPC_NT_INVALID_NAF_ID: u32 = 0xc0020040; +pub const SMB_NTRPC_NT_CANNOT_SUPPORT: u32 = 0xc0020041; +pub const SMB_NTRPC_NT_NO_CONTEXT_AVAILABLE: u32 = 0xc0020042; +pub const SMB_NTRPC_NT_INTERNAL_ERROR: u32 = 0xc0020043; +pub const SMB_NTRPC_NT_ZERO_DIVIDE: u32 = 0xc0020044; +pub const SMB_NTRPC_NT_ADDRESS_ERROR: u32 = 0xc0020045; +pub const SMB_NTRPC_NT_FP_DIV_ZERO: u32 = 0xc0020046; +pub const SMB_NTRPC_NT_FP_UNDERFLOW: u32 = 0xc0020047; +pub const SMB_NTRPC_NT_FP_OVERFLOW: u32 = 0xc0020048; +pub const SMB_NTRPC_NT_CALL_IN_PROGRESS: u32 = 0xc0020049; +pub const SMB_NTRPC_NT_NO_MORE_BINDINGS: u32 = 0xc002004a; +pub const SMB_NTRPC_NT_GROUP_MEMBER_NOT_FOUND: u32 = 0xc002004b; +pub const SMB_NTEPT_NT_CANT_CREATE: u32 = 0xc002004c; +pub const SMB_NTRPC_NT_INVALID_OBJECT: u32 = 0xc002004d; +pub const SMB_NTRPC_NT_NO_INTERFACES: u32 = 0xc002004f; +pub const SMB_NTRPC_NT_CALL_CANCELLED: u32 = 0xc0020050; +pub const SMB_NTRPC_NT_BINDING_INCOMPLETE: u32 = 0xc0020051; +pub const SMB_NTRPC_NT_COMM_FAILURE: u32 = 0xc0020052; +pub const SMB_NTRPC_NT_UNSUPPORTED_AUTHN_LEVEL: u32 = 0xc0020053; +pub const SMB_NTRPC_NT_NO_PRINC_NAME: u32 = 0xc0020054; +pub const SMB_NTRPC_NT_NOT_RPC_ERROR: u32 = 0xc0020055; +pub const SMB_NTRPC_NT_SEC_PKG_ERROR: u32 = 0xc0020057; +pub const SMB_NTRPC_NT_NOT_CANCELLED: u32 = 0xc0020058; +pub const SMB_NTRPC_NT_INVALID_ASYNC_HANDLE: u32 = 0xc0020062; +pub const SMB_NTRPC_NT_INVALID_ASYNC_CALL: u32 = 0xc0020063; +pub const SMB_NTRPC_NT_PROXY_ACCESS_DENIED: u32 = 0xc0020064; +pub const SMB_NTRPC_NT_NO_MORE_ENTRIES: u32 = 0xc0030001; +pub const SMB_NTRPC_NT_SS_CHAR_TRANS_OPEN_FAIL: u32 = 0xc0030002; +pub const SMB_NTRPC_NT_SS_CHAR_TRANS_SHORT_FILE: u32 = 0xc0030003; +pub const SMB_NTRPC_NT_SS_IN_NULL_CONTEXT: u32 = 0xc0030004; +pub const SMB_NTRPC_NT_SS_CONTEXT_MISMATCH: u32 = 0xc0030005; +pub const SMB_NTRPC_NT_SS_CONTEXT_DAMAGED: u32 = 0xc0030006; +pub const SMB_NTRPC_NT_SS_HANDLES_MISMATCH: u32 = 0xc0030007; +pub const SMB_NTRPC_NT_SS_CANNOT_GET_CALL_HANDLE: u32 = 0xc0030008; +pub const SMB_NTRPC_NT_NULL_REF_POINTER: u32 = 0xc0030009; +pub const SMB_NTRPC_NT_ENUM_VALUE_OUT_OF_RANGE: u32 = 0xc003000a; +pub const SMB_NTRPC_NT_BYTE_COUNT_TOO_SMALL: u32 = 0xc003000b; +pub const SMB_NTRPC_NT_BAD_STUB_DATA: u32 = 0xc003000c; +pub const SMB_NTRPC_NT_INVALID_ES_ACTION: u32 = 0xc0030059; +pub const SMB_NTRPC_NT_WRONG_ES_VERSION: u32 = 0xc003005a; +pub const SMB_NTRPC_NT_WRONG_STUB_VERSION: u32 = 0xc003005b; +pub const SMB_NTRPC_NT_INVALID_PIPE_OBJECT: u32 = 0xc003005c; +pub const SMB_NTRPC_NT_INVALID_PIPE_OPERATION: u32 = 0xc003005d; +pub const SMB_NTRPC_NT_WRONG_PIPE_VERSION: u32 = 0xc003005e; +pub const SMB_NTRPC_NT_PIPE_CLOSED: u32 = 0xc003005f; +pub const SMB_NTRPC_NT_PIPE_DISCIPLINE_ERROR: u32 = 0xc0030060; +pub const SMB_NTRPC_NT_PIPE_EMPTY: u32 = 0xc0030061; +pub const SMB_NTSTATUS_PNP_BAD_MPS_TABLE: u32 = 0xc0040035; +pub const SMB_NTSTATUS_PNP_TRANSLATION_FAILED: u32 = 0xc0040036; +pub const SMB_NTSTATUS_PNP_IRQ_TRANSLATION_FAILED: u32 = 0xc0040037; +pub const SMB_NTSTATUS_PNP_INVALID_ID: u32 = 0xc0040038; +pub const SMB_NTSTATUS_IO_REISSUE_AS_CACHED: u32 = 0xc0040039; +pub const SMB_NTSTATUS_CTX_WINSTATION_NAME_INVALID: u32 = 0xc00a0001; +pub const SMB_NTSTATUS_CTX_INVALID_PD: u32 = 0xc00a0002; +pub const SMB_NTSTATUS_CTX_PD_NOT_FOUND: u32 = 0xc00a0003; +pub const SMB_NTSTATUS_CTX_CLOSE_PENDING: u32 = 0xc00a0006; +pub const SMB_NTSTATUS_CTX_NO_OUTBUF: u32 = 0xc00a0007; +pub const SMB_NTSTATUS_CTX_MODEM_INF_NOT_FOUND: u32 = 0xc00a0008; +pub const SMB_NTSTATUS_CTX_INVALID_MODEMNAME: u32 = 0xc00a0009; +pub const SMB_NTSTATUS_CTX_RESPONSE_ERROR: u32 = 0xc00a000a; +pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_TIMEOUT: u32 = 0xc00a000b; +pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_CARRIER: u32 = 0xc00a000c; +pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_DIALTONE: u32 = 0xc00a000d; +pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_BUSY: u32 = 0xc00a000e; +pub const SMB_NTSTATUS_CTX_MODEM_RESPONSE_VOICE: u32 = 0xc00a000f; +pub const SMB_NTSTATUS_CTX_TD_ERROR: u32 = 0xc00a0010; +pub const SMB_NTSTATUS_CTX_LICENSE_CLIENT_INVALID: u32 = 0xc00a0012; +pub const SMB_NTSTATUS_CTX_LICENSE_NOT_AVAILABLE: u32 = 0xc00a0013; +pub const SMB_NTSTATUS_CTX_LICENSE_EXPIRED: u32 = 0xc00a0014; +pub const SMB_NTSTATUS_CTX_WINSTATION_NOT_FOUND: u32 = 0xc00a0015; +pub const SMB_NTSTATUS_CTX_WINSTATION_NAME_COLLISION: u32 = 0xc00a0016; +pub const SMB_NTSTATUS_CTX_WINSTATION_BUSY: u32 = 0xc00a0017; +pub const SMB_NTSTATUS_CTX_BAD_VIDEO_MODE: u32 = 0xc00a0018; +pub const SMB_NTSTATUS_CTX_GRAPHICS_INVALID: u32 = 0xc00a0022; +pub const SMB_NTSTATUS_CTX_NOT_CONSOLE: u32 = 0xc00a0024; +pub const SMB_NTSTATUS_CTX_CLIENT_QUERY_TIMEOUT: u32 = 0xc00a0026; +pub const SMB_NTSTATUS_CTX_CONSOLE_DISCONNECT: u32 = 0xc00a0027; +pub const SMB_NTSTATUS_CTX_CONSOLE_CONNECT: u32 = 0xc00a0028; +pub const SMB_NTSTATUS_CTX_SHADOW_DENIED: u32 = 0xc00a002a; +pub const SMB_NTSTATUS_CTX_WINSTATION_ACCESS_DENIED: u32 = 0xc00a002b; +pub const SMB_NTSTATUS_CTX_INVALID_WD: u32 = 0xc00a002e; +pub const SMB_NTSTATUS_CTX_WD_NOT_FOUND: u32 = 0xc00a002f; +pub const SMB_NTSTATUS_CTX_SHADOW_INVALID: u32 = 0xc00a0030; +pub const SMB_NTSTATUS_CTX_SHADOW_DISABLED: u32 = 0xc00a0031; +pub const SMB_NTSTATUS_RDP_PROTOCOL_ERROR: u32 = 0xc00a0032; +pub const SMB_NTSTATUS_CTX_CLIENT_LICENSE_NOT_SET: u32 = 0xc00a0033; +pub const SMB_NTSTATUS_CTX_CLIENT_LICENSE_IN_USE: u32 = 0xc00a0034; +pub const SMB_NTSTATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE: u32 = 0xc00a0035; +pub const SMB_NTSTATUS_CTX_SHADOW_NOT_RUNNING: u32 = 0xc00a0036; +pub const SMB_NTSTATUS_CTX_LOGON_DISABLED: u32 = 0xc00a0037; +pub const SMB_NTSTATUS_CTX_SECURITY_LAYER_ERROR: u32 = 0xc00a0038; +pub const SMB_NTSTATUS_TS_INCOMPATIBLE_SESSIONS: u32 = 0xc00a0039; +pub const SMB_NTSTATUS_MUI_FILE_NOT_FOUND: u32 = 0xc00b0001; +pub const SMB_NTSTATUS_MUI_INVALID_FILE: u32 = 0xc00b0002; +pub const SMB_NTSTATUS_MUI_INVALID_RC_CONFIG: u32 = 0xc00b0003; +pub const SMB_NTSTATUS_MUI_INVALID_LOCALE_NAME: u32 = 0xc00b0004; +pub const SMB_NTSTATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME: u32 = 0xc00b0005; +pub const SMB_NTSTATUS_MUI_FILE_NOT_LOADED: u32 = 0xc00b0006; +pub const SMB_NTSTATUS_RESOURCE_ENUM_USER_STOP: u32 = 0xc00b0007; +pub const SMB_NTSTATUS_CLUSTER_INVALID_NODE: u32 = 0xc0130001; +pub const SMB_NTSTATUS_CLUSTER_NODE_EXISTS: u32 = 0xc0130002; +pub const SMB_NTSTATUS_CLUSTER_JOIN_IN_PROGRESS: u32 = 0xc0130003; +pub const SMB_NTSTATUS_CLUSTER_NODE_NOT_FOUND: u32 = 0xc0130004; +pub const SMB_NTSTATUS_CLUSTER_LOCAL_NODE_NOT_FOUND: u32 = 0xc0130005; +pub const SMB_NTSTATUS_CLUSTER_NETWORK_EXISTS: u32 = 0xc0130006; +pub const SMB_NTSTATUS_CLUSTER_NETWORK_NOT_FOUND: u32 = 0xc0130007; +pub const SMB_NTSTATUS_CLUSTER_NETINTERFACE_EXISTS: u32 = 0xc0130008; +pub const SMB_NTSTATUS_CLUSTER_NETINTERFACE_NOT_FOUND: u32 = 0xc0130009; +pub const SMB_NTSTATUS_CLUSTER_INVALID_REQUEST: u32 = 0xc013000a; +pub const SMB_NTSTATUS_CLUSTER_INVALID_NETWORK_PROVIDER: u32 = 0xc013000b; +pub const SMB_NTSTATUS_CLUSTER_NODE_DOWN: u32 = 0xc013000c; +pub const SMB_NTSTATUS_CLUSTER_NODE_UNREACHABLE: u32 = 0xc013000d; +pub const SMB_NTSTATUS_CLUSTER_NODE_NOT_MEMBER: u32 = 0xc013000e; +pub const SMB_NTSTATUS_CLUSTER_JOIN_NOT_IN_PROGRESS: u32 = 0xc013000f; +pub const SMB_NTSTATUS_CLUSTER_INVALID_NETWORK: u32 = 0xc0130010; +pub const SMB_NTSTATUS_CLUSTER_NO_NET_ADAPTERS: u32 = 0xc0130011; +pub const SMB_NTSTATUS_CLUSTER_NODE_UP: u32 = 0xc0130012; +pub const SMB_NTSTATUS_CLUSTER_NODE_PAUSED: u32 = 0xc0130013; +pub const SMB_NTSTATUS_CLUSTER_NODE_NOT_PAUSED: u32 = 0xc0130014; +pub const SMB_NTSTATUS_CLUSTER_NO_SECURITY_CONTEXT: u32 = 0xc0130015; +pub const SMB_NTSTATUS_CLUSTER_NETWORK_NOT_INTERNAL: u32 = 0xc0130016; +pub const SMB_NTSTATUS_CLUSTER_POISONED: u32 = 0xc0130017; +pub const SMB_NTSTATUS_ACPI_INVALID_OPCODE: u32 = 0xc0140001; +pub const SMB_NTSTATUS_ACPI_STACK_OVERFLOW: u32 = 0xc0140002; +pub const SMB_NTSTATUS_ACPI_ASSERT_FAILED: u32 = 0xc0140003; +pub const SMB_NTSTATUS_ACPI_INVALID_INDEX: u32 = 0xc0140004; +pub const SMB_NTSTATUS_ACPI_INVALID_ARGUMENT: u32 = 0xc0140005; +pub const SMB_NTSTATUS_ACPI_FATAL: u32 = 0xc0140006; +pub const SMB_NTSTATUS_ACPI_INVALID_SUPERNAME: u32 = 0xc0140007; +pub const SMB_NTSTATUS_ACPI_INVALID_ARGTYPE: u32 = 0xc0140008; +pub const SMB_NTSTATUS_ACPI_INVALID_OBJTYPE: u32 = 0xc0140009; +pub const SMB_NTSTATUS_ACPI_INVALID_TARGETTYPE: u32 = 0xc014000a; +pub const SMB_NTSTATUS_ACPI_INCORRECT_ARGUMENT_COUNT: u32 = 0xc014000b; +pub const SMB_NTSTATUS_ACPI_ADDRESS_NOT_MAPPED: u32 = 0xc014000c; +pub const SMB_NTSTATUS_ACPI_INVALID_EVENTTYPE: u32 = 0xc014000d; +pub const SMB_NTSTATUS_ACPI_HANDLER_COLLISION: u32 = 0xc014000e; +pub const SMB_NTSTATUS_ACPI_INVALID_DATA: u32 = 0xc014000f; +pub const SMB_NTSTATUS_ACPI_INVALID_REGION: u32 = 0xc0140010; +pub const SMB_NTSTATUS_ACPI_INVALID_ACCESS_SIZE: u32 = 0xc0140011; +pub const SMB_NTSTATUS_ACPI_ACQUIRE_GLOBAL_LOCK: u32 = 0xc0140012; +pub const SMB_NTSTATUS_ACPI_ALREADY_INITIALIZED: u32 = 0xc0140013; +pub const SMB_NTSTATUS_ACPI_NOT_INITIALIZED: u32 = 0xc0140014; +pub const SMB_NTSTATUS_ACPI_INVALID_MUTEX_LEVEL: u32 = 0xc0140015; +pub const SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNED: u32 = 0xc0140016; +pub const SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNER: u32 = 0xc0140017; +pub const SMB_NTSTATUS_ACPI_RS_ACCESS: u32 = 0xc0140018; +pub const SMB_NTSTATUS_ACPI_INVALID_TABLE: u32 = 0xc0140019; +pub const SMB_NTSTATUS_ACPI_REG_HANDLER_FAILED: u32 = 0xc0140020; +pub const SMB_NTSTATUS_ACPI_POWER_REQUEST_FAILED: u32 = 0xc0140021; +pub const SMB_NTSTATUS_SXS_SECTION_NOT_FOUND: u32 = 0xc0150001; +pub const SMB_NTSTATUS_SXS_CANT_GEN_ACTCTX: u32 = 0xc0150002; +pub const SMB_NTSTATUS_SXS_INVALID_ACTCTXDATA_FORMAT: u32 = 0xc0150003; +pub const SMB_NTSTATUS_SXS_ASSEMBLY_NOT_FOUND: u32 = 0xc0150004; +pub const SMB_NTSTATUS_SXS_MANIFEST_FORMAT_ERROR: u32 = 0xc0150005; +pub const SMB_NTSTATUS_SXS_MANIFEST_PARSE_ERROR: u32 = 0xc0150006; +pub const SMB_NTSTATUS_SXS_ACTIVATION_CONTEXT_DISABLED: u32 = 0xc0150007; +pub const SMB_NTSTATUS_SXS_KEY_NOT_FOUND: u32 = 0xc0150008; +pub const SMB_NTSTATUS_SXS_VERSION_CONFLICT: u32 = 0xc0150009; +pub const SMB_NTSTATUS_SXS_WRONG_SECTION_TYPE: u32 = 0xc015000a; +pub const SMB_NTSTATUS_SXS_THREAD_QUERIES_DISABLED: u32 = 0xc015000b; +pub const SMB_NTSTATUS_SXS_ASSEMBLY_MISSING: u32 = 0xc015000c; +pub const SMB_NTSTATUS_SXS_PROCESS_DEFAULT_ALREADY_SET: u32 = 0xc015000e; +pub const SMB_NTSTATUS_SXS_EARLY_DEACTIVATION: u32 = 0xc015000f; +pub const SMB_NTSTATUS_SXS_INVALID_DEACTIVATION: u32 = 0xc0150010; +pub const SMB_NTSTATUS_SXS_MULTIPLE_DEACTIVATION: u32 = 0xc0150011; +pub const SMB_NTSTATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: u32 = 0xc0150012; +pub const SMB_NTSTATUS_SXS_PROCESS_TERMINATION_REQUESTED: u32 = 0xc0150013; +pub const SMB_NTSTATUS_SXS_CORRUPT_ACTIVATION_STACK: u32 = 0xc0150014; +pub const SMB_NTSTATUS_SXS_CORRUPTION: u32 = 0xc0150015; +pub const SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: u32 = 0xc0150016; +pub const SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: u32 = 0xc0150017; +pub const SMB_NTSTATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: u32 = 0xc0150018; +pub const SMB_NTSTATUS_SXS_IDENTITY_PARSE_ERROR: u32 = 0xc0150019; +pub const SMB_NTSTATUS_SXS_COMPONENT_STORE_CORRUPT: u32 = 0xc015001a; +pub const SMB_NTSTATUS_SXS_FILE_HASH_MISMATCH: u32 = 0xc015001b; +pub const SMB_NTSTATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: u32 = 0xc015001c; +pub const SMB_NTSTATUS_SXS_IDENTITIES_DIFFERENT: u32 = 0xc015001d; +pub const SMB_NTSTATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: u32 = 0xc015001e; +pub const SMB_NTSTATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY: u32 = 0xc015001f; +pub const SMB_NTSTATUS_ADVANCED_INSTALLER_FAILED: u32 = 0xc0150020; +pub const SMB_NTSTATUS_XML_ENCODING_MISMATCH: u32 = 0xc0150021; +pub const SMB_NTSTATUS_SXS_MANIFEST_TOO_BIG: u32 = 0xc0150022; +pub const SMB_NTSTATUS_SXS_SETTING_NOT_REGISTERED: u32 = 0xc0150023; +pub const SMB_NTSTATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE: u32 = 0xc0150024; +pub const SMB_NTSTATUS_SMI_PRIMITIVE_INSTALLER_FAILED: u32 = 0xc0150025; +pub const SMB_NTSTATUS_GENERIC_COMMAND_FAILED: u32 = 0xc0150026; +pub const SMB_NTSTATUS_SXS_FILE_HASH_MISSING: u32 = 0xc0150027; +pub const SMB_NTSTATUS_TRANSACTIONAL_CONFLICT: u32 = 0xc0190001; +pub const SMB_NTSTATUS_INVALID_TRANSACTION: u32 = 0xc0190002; +pub const SMB_NTSTATUS_TRANSACTION_NOT_ACTIVE: u32 = 0xc0190003; +pub const SMB_NTSTATUS_TM_INITIALIZATION_FAILED: u32 = 0xc0190004; +pub const SMB_NTSTATUS_RM_NOT_ACTIVE: u32 = 0xc0190005; +pub const SMB_NTSTATUS_RM_METADATA_CORRUPT: u32 = 0xc0190006; +pub const SMB_NTSTATUS_TRANSACTION_NOT_JOINED: u32 = 0xc0190007; +pub const SMB_NTSTATUS_DIRECTORY_NOT_RM: u32 = 0xc0190008; +pub const SMB_NTSTATUS_TRANSACTIONS_UNSUPPORTED_REMOTE: u32 = 0xc019000a; +pub const SMB_NTSTATUS_LOG_RESIZE_INVALID_SIZE: u32 = 0xc019000b; +pub const SMB_NTSTATUS_REMOTE_FILE_VERSION_MISMATCH: u32 = 0xc019000c; +pub const SMB_NTSTATUS_CRM_PROTOCOL_ALREADY_EXISTS: u32 = 0xc019000f; +pub const SMB_NTSTATUS_TRANSACTION_PROPAGATION_FAILED: u32 = 0xc0190010; +pub const SMB_NTSTATUS_CRM_PROTOCOL_NOT_FOUND: u32 = 0xc0190011; +pub const SMB_NTSTATUS_TRANSACTION_SUPERIOR_EXISTS: u32 = 0xc0190012; +pub const SMB_NTSTATUS_TRANSACTION_REQUEST_NOT_VALID: u32 = 0xc0190013; +pub const SMB_NTSTATUS_TRANSACTION_NOT_REQUESTED: u32 = 0xc0190014; +pub const SMB_NTSTATUS_TRANSACTION_ALREADY_ABORTED: u32 = 0xc0190015; +pub const SMB_NTSTATUS_TRANSACTION_ALREADY_COMMITTED: u32 = 0xc0190016; +pub const SMB_NTSTATUS_TRANSACTION_INVALID_MARSHALL_BUFFER: u32 = 0xc0190017; +pub const SMB_NTSTATUS_CURRENT_TRANSACTION_NOT_VALID: u32 = 0xc0190018; +pub const SMB_NTSTATUS_LOG_GROWTH_FAILED: u32 = 0xc0190019; +pub const SMB_NTSTATUS_OBJECT_NO_LONGER_EXISTS: u32 = 0xc0190021; +pub const SMB_NTSTATUS_STREAM_MINIVERSION_NOT_FOUND: u32 = 0xc0190022; +pub const SMB_NTSTATUS_STREAM_MINIVERSION_NOT_VALID: u32 = 0xc0190023; +pub const SMB_NTSTATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: u32 = 0xc0190024; +pub const SMB_NTSTATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: u32 = 0xc0190025; +pub const SMB_NTSTATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS: u32 = 0xc0190026; +pub const SMB_NTSTATUS_HANDLE_NO_LONGER_VALID: u32 = 0xc0190028; +pub const SMB_NTSTATUS_LOG_CORRUPTION_DETECTED: u32 = 0xc0190030; +pub const SMB_NTSTATUS_RM_DISCONNECTED: u32 = 0xc0190032; +pub const SMB_NTSTATUS_ENLISTMENT_NOT_SUPERIOR: u32 = 0xc0190033; +pub const SMB_NTSTATUS_FILE_IDENTITY_NOT_PERSISTENT: u32 = 0xc0190036; +pub const SMB_NTSTATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: u32 = 0xc0190037; +pub const SMB_NTSTATUS_CANT_CROSS_RM_BOUNDARY: u32 = 0xc0190038; +pub const SMB_NTSTATUS_TXF_DIR_NOT_EMPTY: u32 = 0xc0190039; +pub const SMB_NTSTATUS_INDOUBT_TRANSACTIONS_EXIST: u32 = 0xc019003a; +pub const SMB_NTSTATUS_TM_VOLATILE: u32 = 0xc019003b; +pub const SMB_NTSTATUS_ROLLBACK_TIMER_EXPIRED: u32 = 0xc019003c; +pub const SMB_NTSTATUS_TXF_ATTRIBUTE_CORRUPT: u32 = 0xc019003d; +pub const SMB_NTSTATUS_EFS_NOT_ALLOWED_IN_TRANSACTION: u32 = 0xc019003e; +pub const SMB_NTSTATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED: u32 = 0xc019003f; +pub const SMB_NTSTATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: u32 = 0xc0190040; +pub const SMB_NTSTATUS_TRANSACTION_REQUIRED_PROMOTION: u32 = 0xc0190043; +pub const SMB_NTSTATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION: u32 = 0xc0190044; +pub const SMB_NTSTATUS_TRANSACTIONS_NOT_FROZEN: u32 = 0xc0190045; +pub const SMB_NTSTATUS_TRANSACTION_FREEZE_IN_PROGRESS: u32 = 0xc0190046; +pub const SMB_NTSTATUS_NOT_SNAPSHOT_VOLUME: u32 = 0xc0190047; +pub const SMB_NTSTATUS_NO_SAVEPOINT_WITH_OPEN_FILES: u32 = 0xc0190048; +pub const SMB_NTSTATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION: u32 = 0xc0190049; +pub const SMB_NTSTATUS_TM_IDENTITY_MISMATCH: u32 = 0xc019004a; +pub const SMB_NTSTATUS_FLOATED_SECTION: u32 = 0xc019004b; +pub const SMB_NTSTATUS_CANNOT_ACCEPT_TRANSACTED_WORK: u32 = 0xc019004c; +pub const SMB_NTSTATUS_CANNOT_ABORT_TRANSACTIONS: u32 = 0xc019004d; +pub const SMB_NTSTATUS_TRANSACTION_NOT_FOUND: u32 = 0xc019004e; +pub const SMB_NTSTATUS_RESOURCEMANAGER_NOT_FOUND: u32 = 0xc019004f; +pub const SMB_NTSTATUS_ENLISTMENT_NOT_FOUND: u32 = 0xc0190050; +pub const SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_FOUND: u32 = 0xc0190051; +pub const SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_ONLINE: u32 = 0xc0190052; +pub const SMB_NTSTATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: u32 = 0xc0190053; +pub const SMB_NTSTATUS_TRANSACTION_NOT_ROOT: u32 = 0xc0190054; +pub const SMB_NTSTATUS_TRANSACTION_OBJECT_EXPIRED: u32 = 0xc0190055; +pub const SMB_NTSTATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: u32 = 0xc0190056; +pub const SMB_NTSTATUS_TRANSACTION_RESPONSE_NOT_ENLISTED: u32 = 0xc0190057; +pub const SMB_NTSTATUS_TRANSACTION_RECORD_TOO_LONG: u32 = 0xc0190058; +pub const SMB_NTSTATUS_NO_LINK_TRACKING_IN_TRANSACTION: u32 = 0xc0190059; +pub const SMB_NTSTATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: u32 = 0xc019005a; +pub const SMB_NTSTATUS_TRANSACTION_INTEGRITY_VIOLATED: u32 = 0xc019005b; +pub const SMB_NTSTATUS_EXPIRED_HANDLE: u32 = 0xc0190060; +pub const SMB_NTSTATUS_TRANSACTION_NOT_ENLISTED: u32 = 0xc0190061; +pub const SMB_NTSTATUS_LOG_SECTOR_INVALID: u32 = 0xc01a0001; +pub const SMB_NTSTATUS_LOG_SECTOR_PARITY_INVALID: u32 = 0xc01a0002; +pub const SMB_NTSTATUS_LOG_SECTOR_REMAPPED: u32 = 0xc01a0003; +pub const SMB_NTSTATUS_LOG_BLOCK_INCOMPLETE: u32 = 0xc01a0004; +pub const SMB_NTSTATUS_LOG_INVALID_RANGE: u32 = 0xc01a0005; +pub const SMB_NTSTATUS_LOG_BLOCKS_EXHAUSTED: u32 = 0xc01a0006; +pub const SMB_NTSTATUS_LOG_READ_CONTEXT_INVALID: u32 = 0xc01a0007; +pub const SMB_NTSTATUS_LOG_RESTART_INVALID: u32 = 0xc01a0008; +pub const SMB_NTSTATUS_LOG_BLOCK_VERSION: u32 = 0xc01a0009; +pub const SMB_NTSTATUS_LOG_BLOCK_INVALID: u32 = 0xc01a000a; +pub const SMB_NTSTATUS_LOG_READ_MODE_INVALID: u32 = 0xc01a000b; +pub const SMB_NTSTATUS_LOG_METADATA_CORRUPT: u32 = 0xc01a000d; +pub const SMB_NTSTATUS_LOG_METADATA_INVALID: u32 = 0xc01a000e; +pub const SMB_NTSTATUS_LOG_METADATA_INCONSISTENT: u32 = 0xc01a000f; +pub const SMB_NTSTATUS_LOG_RESERVATION_INVALID: u32 = 0xc01a0010; +pub const SMB_NTSTATUS_LOG_CANT_DELETE: u32 = 0xc01a0011; +pub const SMB_NTSTATUS_LOG_CONTAINER_LIMIT_EXCEEDED: u32 = 0xc01a0012; +pub const SMB_NTSTATUS_LOG_START_OF_LOG: u32 = 0xc01a0013; +pub const SMB_NTSTATUS_LOG_POLICY_ALREADY_INSTALLED: u32 = 0xc01a0014; +pub const SMB_NTSTATUS_LOG_POLICY_NOT_INSTALLED: u32 = 0xc01a0015; +pub const SMB_NTSTATUS_LOG_POLICY_INVALID: u32 = 0xc01a0016; +pub const SMB_NTSTATUS_LOG_POLICY_CONFLICT: u32 = 0xc01a0017; +pub const SMB_NTSTATUS_LOG_PINNED_ARCHIVE_TAIL: u32 = 0xc01a0018; +pub const SMB_NTSTATUS_LOG_RECORD_NONEXISTENT: u32 = 0xc01a0019; +pub const SMB_NTSTATUS_LOG_RECORDS_RESERVED_INVALID: u32 = 0xc01a001a; +pub const SMB_NTSTATUS_LOG_SPACE_RESERVED_INVALID: u32 = 0xc01a001b; +pub const SMB_NTSTATUS_LOG_TAIL_INVALID: u32 = 0xc01a001c; +pub const SMB_NTSTATUS_LOG_FULL: u32 = 0xc01a001d; +pub const SMB_NTSTATUS_LOG_MULTIPLEXED: u32 = 0xc01a001e; +pub const SMB_NTSTATUS_LOG_DEDICATED: u32 = 0xc01a001f; +pub const SMB_NTSTATUS_LOG_ARCHIVE_NOT_IN_PROGRESS: u32 = 0xc01a0020; +pub const SMB_NTSTATUS_LOG_ARCHIVE_IN_PROGRESS: u32 = 0xc01a0021; +pub const SMB_NTSTATUS_LOG_EPHEMERAL: u32 = 0xc01a0022; +pub const SMB_NTSTATUS_LOG_NOT_ENOUGH_CONTAINERS: u32 = 0xc01a0023; +pub const SMB_NTSTATUS_LOG_CLIENT_ALREADY_REGISTERED: u32 = 0xc01a0024; +pub const SMB_NTSTATUS_LOG_CLIENT_NOT_REGISTERED: u32 = 0xc01a0025; +pub const SMB_NTSTATUS_LOG_FULL_HANDLER_IN_PROGRESS: u32 = 0xc01a0026; +pub const SMB_NTSTATUS_LOG_CONTAINER_READ_FAILED: u32 = 0xc01a0027; +pub const SMB_NTSTATUS_LOG_CONTAINER_WRITE_FAILED: u32 = 0xc01a0028; +pub const SMB_NTSTATUS_LOG_CONTAINER_OPEN_FAILED: u32 = 0xc01a0029; +pub const SMB_NTSTATUS_LOG_CONTAINER_STATE_INVALID: u32 = 0xc01a002a; +pub const SMB_NTSTATUS_LOG_STATE_INVALID: u32 = 0xc01a002b; +pub const SMB_NTSTATUS_LOG_PINNED: u32 = 0xc01a002c; +pub const SMB_NTSTATUS_LOG_METADATA_FLUSH_FAILED: u32 = 0xc01a002d; +pub const SMB_NTSTATUS_LOG_INCONSISTENT_SECURITY: u32 = 0xc01a002e; +pub const SMB_NTSTATUS_LOG_APPENDED_FLUSH_FAILED: u32 = 0xc01a002f; +pub const SMB_NTSTATUS_LOG_PINNED_RESERVATION: u32 = 0xc01a0030; +pub const SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD: u32 = 0xc01b00ea; +pub const SMB_NTSTATUS_FLT_NO_HANDLER_DEFINED: u32 = 0xc01c0001; +pub const SMB_NTSTATUS_FLT_CONTEXT_ALREADY_DEFINED: u32 = 0xc01c0002; +pub const SMB_NTSTATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST: u32 = 0xc01c0003; +pub const SMB_NTSTATUS_FLT_DISALLOW_FAST_IO: u32 = 0xc01c0004; +pub const SMB_NTSTATUS_FLT_INVALID_NAME_REQUEST: u32 = 0xc01c0005; +pub const SMB_NTSTATUS_FLT_NOT_SAFE_TO_POST_OPERATION: u32 = 0xc01c0006; +pub const SMB_NTSTATUS_FLT_NOT_INITIALIZED: u32 = 0xc01c0007; +pub const SMB_NTSTATUS_FLT_FILTER_NOT_READY: u32 = 0xc01c0008; +pub const SMB_NTSTATUS_FLT_POST_OPERATION_CLEANUP: u32 = 0xc01c0009; +pub const SMB_NTSTATUS_FLT_INTERNAL_ERROR: u32 = 0xc01c000a; +pub const SMB_NTSTATUS_FLT_DELETING_OBJECT: u32 = 0xc01c000b; +pub const SMB_NTSTATUS_FLT_MUST_BE_NONPAGED_POOL: u32 = 0xc01c000c; +pub const SMB_NTSTATUS_FLT_DUPLICATE_ENTRY: u32 = 0xc01c000d; +pub const SMB_NTSTATUS_FLT_CBDQ_DISABLED: u32 = 0xc01c000e; +pub const SMB_NTSTATUS_FLT_DO_NOT_ATTACH: u32 = 0xc01c000f; +pub const SMB_NTSTATUS_FLT_DO_NOT_DETACH: u32 = 0xc01c0010; +pub const SMB_NTSTATUS_FLT_INSTANCE_ALTITUDE_COLLISION: u32 = 0xc01c0011; +pub const SMB_NTSTATUS_FLT_INSTANCE_NAME_COLLISION: u32 = 0xc01c0012; +pub const SMB_NTSTATUS_FLT_FILTER_NOT_FOUND: u32 = 0xc01c0013; +pub const SMB_NTSTATUS_FLT_VOLUME_NOT_FOUND: u32 = 0xc01c0014; +pub const SMB_NTSTATUS_FLT_INSTANCE_NOT_FOUND: u32 = 0xc01c0015; +pub const SMB_NTSTATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND: u32 = 0xc01c0016; +pub const SMB_NTSTATUS_FLT_INVALID_CONTEXT_REGISTRATION: u32 = 0xc01c0017; +pub const SMB_NTSTATUS_FLT_NAME_CACHE_MISS: u32 = 0xc01c0018; +pub const SMB_NTSTATUS_FLT_NO_DEVICE_OBJECT: u32 = 0xc01c0019; +pub const SMB_NTSTATUS_FLT_VOLUME_ALREADY_MOUNTED: u32 = 0xc01c001a; +pub const SMB_NTSTATUS_FLT_ALREADY_ENLISTED: u32 = 0xc01c001b; +pub const SMB_NTSTATUS_FLT_CONTEXT_ALREADY_LINKED: u32 = 0xc01c001c; +pub const SMB_NTSTATUS_FLT_NO_WAITER_FOR_REPLY: u32 = 0xc01c0020; +pub const SMB_NTSTATUS_MONITOR_NO_DESCRIPTOR: u32 = 0xc01d0001; +pub const SMB_NTSTATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: u32 = 0xc01d0002; +pub const SMB_NTSTATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: u32 = 0xc01d0003; +pub const SMB_NTSTATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK: u32 = 0xc01d0004; +pub const SMB_NTSTATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: u32 = 0xc01d0005; +pub const SMB_NTSTATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: u32 = 0xc01d0006; +pub const SMB_NTSTATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: u32 = 0xc01d0007; +pub const SMB_NTSTATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA: u32 = 0xc01d0008; +pub const SMB_NTSTATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK: u32 = 0xc01d0009; +pub const SMB_NTSTATUS_MONITOR_INVALID_MANUFACTURE_DATE: u32 = 0xc01d000a; +pub const SMB_NTSTATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: u32 = 0xc01e0000; +pub const SMB_NTSTATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: u32 = 0xc01e0001; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER: u32 = 0xc01e0002; +pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_WAS_RESET: u32 = 0xc01e0003; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_DRIVER_MODEL: u32 = 0xc01e0004; +pub const SMB_NTSTATUS_GRAPHICS_PRESENT_MODE_CHANGED: u32 = 0xc01e0005; +pub const SMB_NTSTATUS_GRAPHICS_PRESENT_OCCLUDED: u32 = 0xc01e0006; +pub const SMB_NTSTATUS_GRAPHICS_PRESENT_DENIED: u32 = 0xc01e0007; +pub const SMB_NTSTATUS_GRAPHICS_CANNOTCOLORCONVERT: u32 = 0xc01e0008; +pub const SMB_NTSTATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED: u32 = 0xc01e000b; +pub const SMB_NTSTATUS_GRAPHICS_PRESENT_UNOCCLUDED: u32 = 0xc01e000c; +pub const SMB_NTSTATUS_GRAPHICS_NO_VIDEO_MEMORY: u32 = 0xc01e0100; +pub const SMB_NTSTATUS_GRAPHICS_CANT_LOCK_MEMORY: u32 = 0xc01e0101; +pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_BUSY: u32 = 0xc01e0102; +pub const SMB_NTSTATUS_GRAPHICS_TOO_MANY_REFERENCES: u32 = 0xc01e0103; +pub const SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_LATER: u32 = 0xc01e0104; +pub const SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_NOW: u32 = 0xc01e0105; +pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_INVALID: u32 = 0xc01e0106; +pub const SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: u32 = 0xc01e0107; +pub const SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: u32 = 0xc01e0108; +pub const SMB_NTSTATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: u32 = 0xc01e0109; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_USAGE: u32 = 0xc01e0110; +pub const SMB_NTSTATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: u32 = 0xc01e0111; +pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_CLOSED: u32 = 0xc01e0112; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE: u32 = 0xc01e0113; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE: u32 = 0xc01e0114; +pub const SMB_NTSTATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE: u32 = 0xc01e0115; +pub const SMB_NTSTATUS_GRAPHICS_ALLOCATION_CONTENT_LOST: u32 = 0xc01e0116; +pub const SMB_NTSTATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: u32 = 0xc01e0200; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY: u32 = 0xc01e0300; +pub const SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: u32 = 0xc01e0301; +pub const SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: u32 = 0xc01e0302; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN: u32 = 0xc01e0303; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: u32 = 0xc01e0304; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: u32 = 0xc01e0305; +pub const SMB_NTSTATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: u32 = 0xc01e0306; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: u32 = 0xc01e0308; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET: u32 = 0xc01e0309; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_FREQUENCY: u32 = 0xc01e030a; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_ACTIVE_REGION: u32 = 0xc01e030b; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_TOTAL_REGION: u32 = 0xc01e030c; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: u32 = 0xc01e0310; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: u32 = 0xc01e0311; +pub const SMB_NTSTATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: u32 = 0xc01e0312; +pub const SMB_NTSTATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: u32 = 0xc01e0313; +pub const SMB_NTSTATUS_GRAPHICS_MODE_ALREADY_IN_MODESET: u32 = 0xc01e0314; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: u32 = 0xc01e0315; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: u32 = 0xc01e0316; +pub const SMB_NTSTATUS_GRAPHICS_SOURCE_ALREADY_IN_SET: u32 = 0xc01e0317; +pub const SMB_NTSTATUS_GRAPHICS_TARGET_ALREADY_IN_SET: u32 = 0xc01e0318; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: u32 = 0xc01e0319; +pub const SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: u32 = 0xc01e031a; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: u32 = 0xc01e031b; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: u32 = 0xc01e031c; +pub const SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: u32 = 0xc01e031d; +pub const SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: u32 = 0xc01e031f; +pub const SMB_NTSTATUS_GRAPHICS_STALE_MODESET: u32 = 0xc01e0320; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: u32 = 0xc01e0321; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: u32 = 0xc01e0322; +pub const SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: u32 = 0xc01e0323; +pub const SMB_NTSTATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: u32 = 0xc01e0324; +pub const SMB_NTSTATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: u32 = 0xc01e0325; +pub const SMB_NTSTATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: u32 = 0xc01e0326; +pub const SMB_NTSTATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY: u32 = 0xc01e0327; +pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: u32 = 0xc01e0328; +pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: u32 = 0xc01e0329; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET: u32 = 0xc01e032a; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR: u32 = 0xc01e032b; +pub const SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: u32 = 0xc01e032c; +pub const SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: u32 = 0xc01e032d; +pub const SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: u32 = 0xc01e032e; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: u32 = 0xc01e032f; +pub const SMB_NTSTATUS_GRAPHICS_RESOURCES_NOT_RELATED: u32 = 0xc01e0330; +pub const SMB_NTSTATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: u32 = 0xc01e0331; +pub const SMB_NTSTATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: u32 = 0xc01e0332; +pub const SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: u32 = 0xc01e0333; +pub const SMB_NTSTATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: u32 = 0xc01e0334; +pub const SMB_NTSTATUS_GRAPHICS_NO_VIDPNMGR: u32 = 0xc01e0335; +pub const SMB_NTSTATUS_GRAPHICS_NO_ACTIVE_VIDPN: u32 = 0xc01e0336; +pub const SMB_NTSTATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY: u32 = 0xc01e0337; +pub const SMB_NTSTATUS_GRAPHICS_MONITOR_NOT_CONNECTED: u32 = 0xc01e0338; +pub const SMB_NTSTATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: u32 = 0xc01e0339; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: u32 = 0xc01e033a; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE: u32 = 0xc01e033b; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_STRIDE: u32 = 0xc01e033c; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_PIXELFORMAT: u32 = 0xc01e033d; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_COLORBASIS: u32 = 0xc01e033e; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: u32 = 0xc01e033f; +pub const SMB_NTSTATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: u32 = 0xc01e0340; +pub const SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: u32 = 0xc01e0341; +pub const SMB_NTSTATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: u32 = 0xc01e0342; +pub const SMB_NTSTATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: u32 = 0xc01e0343; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: u32 = 0xc01e0344; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: u32 = 0xc01e0345; +pub const SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: u32 = + 0xc01e0346; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_GAMMA_RAMP: u32 = 0xc01e0347; +pub const SMB_NTSTATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: u32 = 0xc01e0348; +pub const SMB_NTSTATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: u32 = 0xc01e0349; +pub const SMB_NTSTATUS_GRAPHICS_MODE_NOT_IN_MODESET: u32 = 0xc01e034a; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: u32 = 0xc01e034d; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE: u32 = 0xc01e034e; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE: u32 = 0xc01e034f; +pub const SMB_NTSTATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: u32 = 0xc01e0350; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_SCANLINE_ORDERING: u32 = 0xc01e0352; +pub const SMB_NTSTATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: u32 = 0xc01e0353; +pub const SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: u32 = 0xc01e0354; +pub const SMB_NTSTATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: u32 = 0xc01e0355; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: u32 = 0xc01e0356; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: u32 = 0xc01e0357; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: u32 = 0xc01e0358; +pub const SMB_NTSTATUS_GRAPHICS_MAX_NUM_PATHS_REACHED: u32 = 0xc01e0359; +pub const SMB_NTSTATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: u32 = 0xc01e035a; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_CLIENT_TYPE: u32 = 0xc01e035b; +pub const SMB_NTSTATUS_GRAPHICS_CLIENTVIDPN_NOT_SET: u32 = 0xc01e035c; +pub const SMB_NTSTATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: u32 = 0xc01e0400; +pub const SMB_NTSTATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: u32 = 0xc01e0401; +pub const SMB_NTSTATUS_GRAPHICS_NOT_A_LINKED_ADAPTER: u32 = 0xc01e0430; +pub const SMB_NTSTATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED: u32 = 0xc01e0431; +pub const SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: u32 = 0xc01e0432; +pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY: u32 = 0xc01e0433; +pub const SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_STARTED: u32 = 0xc01e0434; +pub const SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: u32 = 0xc01e0435; +pub const SMB_NTSTATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: u32 = 0xc01e0436; +pub const SMB_NTSTATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER: u32 = 0xc01e0438; +pub const SMB_NTSTATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: u32 = 0xc01e043b; +pub const SMB_NTSTATUS_GRAPHICS_OPM_NOT_SUPPORTED: u32 = 0xc01e0500; +pub const SMB_NTSTATUS_GRAPHICS_COPP_NOT_SUPPORTED: u32 = 0xc01e0501; +pub const SMB_NTSTATUS_GRAPHICS_UAB_NOT_SUPPORTED: u32 = 0xc01e0502; +pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: u32 = 0xc01e0503; +pub const SMB_NTSTATUS_GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL: u32 = 0xc01e0504; +pub const SMB_NTSTATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST: u32 = 0xc01e0505; +pub const SMB_NTSTATUS_GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: u32 = 0xc01e0506; +pub const SMB_NTSTATUS_GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: u32 = 0xc01e0507; +pub const SMB_NTSTATUS_GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED: u32 = 0xc01e0508; +pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_POINTER: u32 = 0xc01e050a; +pub const SMB_NTSTATUS_GRAPHICS_OPM_INTERNAL_ERROR: u32 = 0xc01e050b; +pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_HANDLE: u32 = 0xc01e050c; +pub const SMB_NTSTATUS_GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: u32 = 0xc01e050d; +pub const SMB_NTSTATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: u32 = 0xc01e050e; +pub const SMB_NTSTATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED: u32 = 0xc01e050f; +pub const SMB_NTSTATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED: u32 = 0xc01e0510; +pub const SMB_NTSTATUS_GRAPHICS_PVP_HFS_FAILED: u32 = 0xc01e0511; +pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_SRM: u32 = 0xc01e0512; +pub const SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: u32 = 0xc01e0513; +pub const SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: u32 = 0xc01e0514; +pub const SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: u32 = 0xc01e0515; +pub const SMB_NTSTATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: u32 = 0xc01e0516; +pub const SMB_NTSTATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: u32 = 0xc01e0517; +pub const SMB_NTSTATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: u32 = 0xc01e0518; +pub const SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS: u32 = 0xc01e051a; +pub const SMB_NTSTATUS_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS: u32 = 0xc01e051b; +pub const SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: u32 = 0xc01e051c; +pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: u32 = 0xc01e051d; +pub const SMB_NTSTATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: u32 = 0xc01e051e; +pub const SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: u32 = 0xc01e051f; +pub const SMB_NTSTATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: u32 = 0xc01e0520; +pub const SMB_NTSTATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: u32 = 0xc01e0521; +pub const SMB_NTSTATUS_GRAPHICS_I2C_NOT_SUPPORTED: u32 = 0xc01e0580; +pub const SMB_NTSTATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: u32 = 0xc01e0581; +pub const SMB_NTSTATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: u32 = 0xc01e0582; +pub const SMB_NTSTATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA: u32 = 0xc01e0583; +pub const SMB_NTSTATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: u32 = 0xc01e0584; +pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_DATA: u32 = 0xc01e0585; +pub const SMB_NTSTATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: u32 = 0xc01e0586; +pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING: u32 = 0xc01e0587; +pub const SMB_NTSTATUS_GRAPHICS_MCA_INTERNAL_ERROR: u32 = 0xc01e0588; +pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: u32 = 0xc01e0589; +pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: u32 = 0xc01e058a; +pub const SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: u32 = 0xc01e058b; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: u32 = 0xc01e058c; +pub const SMB_NTSTATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS: u32 = 0xc01e058d; +pub const SMB_NTSTATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: u32 = 0xc01e05e0; +pub const SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: u32 = 0xc01e05e1; +pub const SMB_NTSTATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: u32 = 0xc01e05e2; +pub const SMB_NTSTATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: u32 = 0xc01e05e3; +pub const SMB_NTSTATUS_GRAPHICS_INVALID_POINTER: u32 = 0xc01e05e4; +pub const SMB_NTSTATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: u32 = 0xc01e05e5; +pub const SMB_NTSTATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: u32 = 0xc01e05e6; +pub const SMB_NTSTATUS_GRAPHICS_INTERNAL_ERROR: u32 = 0xc01e05e7; +pub const SMB_NTSTATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: u32 = 0xc01e05e8; +pub const SMB_NTSTATUS_FVE_LOCKED_VOLUME: u32 = 0xc0210000; +pub const SMB_NTSTATUS_FVE_NOT_ENCRYPTED: u32 = 0xc0210001; +pub const SMB_NTSTATUS_FVE_BAD_INFORMATION: u32 = 0xc0210002; +pub const SMB_NTSTATUS_FVE_TOO_SMALL: u32 = 0xc0210003; +pub const SMB_NTSTATUS_FVE_FAILED_WRONG_FS: u32 = 0xc0210004; +pub const SMB_NTSTATUS_FVE_FAILED_BAD_FS: u32 = 0xc0210005; +pub const SMB_NTSTATUS_FVE_FS_NOT_EXTENDED: u32 = 0xc0210006; +pub const SMB_NTSTATUS_FVE_FS_MOUNTED: u32 = 0xc0210007; +pub const SMB_NTSTATUS_FVE_NO_LICENSE: u32 = 0xc0210008; +pub const SMB_NTSTATUS_FVE_ACTION_NOT_ALLOWED: u32 = 0xc0210009; +pub const SMB_NTSTATUS_FVE_BAD_DATA: u32 = 0xc021000a; +pub const SMB_NTSTATUS_FVE_VOLUME_NOT_BOUND: u32 = 0xc021000b; +pub const SMB_NTSTATUS_FVE_NOT_DATA_VOLUME: u32 = 0xc021000c; +pub const SMB_NTSTATUS_FVE_CONV_READ_ERROR: u32 = 0xc021000d; +pub const SMB_NTSTATUS_FVE_CONV_WRITE_ERROR: u32 = 0xc021000e; +pub const SMB_NTSTATUS_FVE_OVERLAPPED_UPDATE: u32 = 0xc021000f; +pub const SMB_NTSTATUS_FVE_FAILED_SECTOR_SIZE: u32 = 0xc0210010; +pub const SMB_NTSTATUS_FVE_FAILED_AUTHENTICATION: u32 = 0xc0210011; +pub const SMB_NTSTATUS_FVE_NOT_OS_VOLUME: u32 = 0xc0210012; +pub const SMB_NTSTATUS_FVE_KEYFILE_NOT_FOUND: u32 = 0xc0210013; +pub const SMB_NTSTATUS_FVE_KEYFILE_INVALID: u32 = 0xc0210014; +pub const SMB_NTSTATUS_FVE_KEYFILE_NO_VMK: u32 = 0xc0210015; +pub const SMB_NTSTATUS_FVE_TPM_DISABLED: u32 = 0xc0210016; +pub const SMB_NTSTATUS_FVE_TPM_SRK_AUTH_NOT_ZERO: u32 = 0xc0210017; +pub const SMB_NTSTATUS_FVE_TPM_INVALID_PCR: u32 = 0xc0210018; +pub const SMB_NTSTATUS_FVE_TPM_NO_VMK: u32 = 0xc0210019; +pub const SMB_NTSTATUS_FVE_PIN_INVALID: u32 = 0xc021001a; +pub const SMB_NTSTATUS_FVE_AUTH_INVALID_APPLICATION: u32 = 0xc021001b; +pub const SMB_NTSTATUS_FVE_AUTH_INVALID_CONFIG: u32 = 0xc021001c; +pub const SMB_NTSTATUS_FVE_DEBUGGER_ENABLED: u32 = 0xc021001d; +pub const SMB_NTSTATUS_FVE_DRY_RUN_FAILED: u32 = 0xc021001e; +pub const SMB_NTSTATUS_FVE_BAD_METADATA_POINTER: u32 = 0xc021001f; +pub const SMB_NTSTATUS_FVE_OLD_METADATA_COPY: u32 = 0xc0210020; +pub const SMB_NTSTATUS_FVE_REBOOT_REQUIRED: u32 = 0xc0210021; +pub const SMB_NTSTATUS_FVE_RAW_ACCESS: u32 = 0xc0210022; +pub const SMB_NTSTATUS_FVE_RAW_BLOCKED: u32 = 0xc0210023; +pub const SMB_NTSTATUS_FVE_NO_FEATURE_LICENSE: u32 = 0xc0210026; +pub const SMB_NTSTATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: u32 = 0xc0210027; +pub const SMB_NTSTATUS_FVE_CONV_RECOVERY_FAILED: u32 = 0xc0210028; +pub const SMB_NTSTATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG: u32 = 0xc0210029; +pub const SMB_NTSTATUS_FVE_VOLUME_TOO_SMALL: u32 = 0xc0210030; +pub const SMB_NTSTATUS_FWP_CALLOUT_NOT_FOUND: u32 = 0xc0220001; +pub const SMB_NTSTATUS_FWP_CONDITION_NOT_FOUND: u32 = 0xc0220002; +pub const SMB_NTSTATUS_FWP_FILTER_NOT_FOUND: u32 = 0xc0220003; +pub const SMB_NTSTATUS_FWP_LAYER_NOT_FOUND: u32 = 0xc0220004; +pub const SMB_NTSTATUS_FWP_PROVIDER_NOT_FOUND: u32 = 0xc0220005; +pub const SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND: u32 = 0xc0220006; +pub const SMB_NTSTATUS_FWP_SUBLAYER_NOT_FOUND: u32 = 0xc0220007; +pub const SMB_NTSTATUS_FWP_NOT_FOUND: u32 = 0xc0220008; +pub const SMB_NTSTATUS_FWP_ALREADY_EXISTS: u32 = 0xc0220009; +pub const SMB_NTSTATUS_FWP_IN_USE: u32 = 0xc022000a; +pub const SMB_NTSTATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS: u32 = 0xc022000b; +pub const SMB_NTSTATUS_FWP_WRONG_SESSION: u32 = 0xc022000c; +pub const SMB_NTSTATUS_FWP_NO_TXN_IN_PROGRESS: u32 = 0xc022000d; +pub const SMB_NTSTATUS_FWP_TXN_IN_PROGRESS: u32 = 0xc022000e; +pub const SMB_NTSTATUS_FWP_TXN_ABORTED: u32 = 0xc022000f; +pub const SMB_NTSTATUS_FWP_SESSION_ABORTED: u32 = 0xc0220010; +pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_TXN: u32 = 0xc0220011; +pub const SMB_NTSTATUS_FWP_TIMEOUT: u32 = 0xc0220012; +pub const SMB_NTSTATUS_FWP_NET_EVENTS_DISABLED: u32 = 0xc0220013; +pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_LAYER: u32 = 0xc0220014; +pub const SMB_NTSTATUS_FWP_KM_CLIENTS_ONLY: u32 = 0xc0220015; +pub const SMB_NTSTATUS_FWP_LIFETIME_MISMATCH: u32 = 0xc0220016; +pub const SMB_NTSTATUS_FWP_BUILTIN_OBJECT: u32 = 0xc0220017; +pub const SMB_NTSTATUS_FWP_TOO_MANY_BOOTTIME_FILTERS: u32 = 0xc0220018; +pub const SMB_NTSTATUS_FWP_NOTIFICATION_DROPPED: u32 = 0xc0220019; +pub const SMB_NTSTATUS_FWP_TRAFFIC_MISMATCH: u32 = 0xc022001a; +pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_SA_STATE: u32 = 0xc022001b; +pub const SMB_NTSTATUS_FWP_NULL_POINTER: u32 = 0xc022001c; +pub const SMB_NTSTATUS_FWP_INVALID_ENUMERATOR: u32 = 0xc022001d; +pub const SMB_NTSTATUS_FWP_INVALID_FLAGS: u32 = 0xc022001e; +pub const SMB_NTSTATUS_FWP_INVALID_NET_MASK: u32 = 0xc022001f; +pub const SMB_NTSTATUS_FWP_INVALID_RANGE: u32 = 0xc0220020; +pub const SMB_NTSTATUS_FWP_INVALID_INTERVAL: u32 = 0xc0220021; +pub const SMB_NTSTATUS_FWP_ZERO_LENGTH_ARRAY: u32 = 0xc0220022; +pub const SMB_NTSTATUS_FWP_NULL_DISPLAY_NAME: u32 = 0xc0220023; +pub const SMB_NTSTATUS_FWP_INVALID_ACTION_TYPE: u32 = 0xc0220024; +pub const SMB_NTSTATUS_FWP_INVALID_WEIGHT: u32 = 0xc0220025; +pub const SMB_NTSTATUS_FWP_MATCH_TYPE_MISMATCH: u32 = 0xc0220026; +pub const SMB_NTSTATUS_FWP_TYPE_MISMATCH: u32 = 0xc0220027; +pub const SMB_NTSTATUS_FWP_OUT_OF_BOUNDS: u32 = 0xc0220028; +pub const SMB_NTSTATUS_FWP_RESERVED: u32 = 0xc0220029; +pub const SMB_NTSTATUS_FWP_DUPLICATE_CONDITION: u32 = 0xc022002a; +pub const SMB_NTSTATUS_FWP_DUPLICATE_KEYMOD: u32 = 0xc022002b; +pub const SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER: u32 = 0xc022002c; +pub const SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER: u32 = 0xc022002d; +pub const SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER: u32 = 0xc022002e; +pub const SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: u32 = 0xc022002f; +pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_METHOD: u32 = 0xc0220030; +pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_DH_GROUP: u32 = 0xc0220031; +pub const SMB_NTSTATUS_FWP_EM_NOT_SUPPORTED: u32 = 0xc0220032; +pub const SMB_NTSTATUS_FWP_NEVER_MATCH: u32 = 0xc0220033; +pub const SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_MISMATCH: u32 = 0xc0220034; +pub const SMB_NTSTATUS_FWP_INVALID_PARAMETER: u32 = 0xc0220035; +pub const SMB_NTSTATUS_FWP_TOO_MANY_SUBLAYERS: u32 = 0xc0220036; +pub const SMB_NTSTATUS_FWP_CALLOUT_NOTIFICATION_FAILED: u32 = 0xc0220037; +pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_CONFIG: u32 = 0xc0220038; +pub const SMB_NTSTATUS_FWP_INCOMPATIBLE_CIPHER_CONFIG: u32 = 0xc0220039; +pub const SMB_NTSTATUS_FWP_DUPLICATE_AUTH_METHOD: u32 = 0xc022003c; +pub const SMB_NTSTATUS_FWP_TCPIP_NOT_READY: u32 = 0xc0220100; +pub const SMB_NTSTATUS_FWP_INJECT_HANDLE_CLOSING: u32 = 0xc0220101; +pub const SMB_NTSTATUS_FWP_INJECT_HANDLE_STALE: u32 = 0xc0220102; +pub const SMB_NTSTATUS_FWP_CANNOT_PEND: u32 = 0xc0220103; +pub const SMB_NTSTATUS_NDIS_CLOSING: u32 = 0xc0230002; +pub const SMB_NTSTATUS_NDIS_BAD_VERSION: u32 = 0xc0230004; +pub const SMB_NTSTATUS_NDIS_BAD_CHARACTERISTICS: u32 = 0xc0230005; +pub const SMB_NTSTATUS_NDIS_ADAPTER_NOT_FOUND: u32 = 0xc0230006; +pub const SMB_NTSTATUS_NDIS_OPEN_FAILED: u32 = 0xc0230007; +pub const SMB_NTSTATUS_NDIS_DEVICE_FAILED: u32 = 0xc0230008; +pub const SMB_NTSTATUS_NDIS_MULTICAST_FULL: u32 = 0xc0230009; +pub const SMB_NTSTATUS_NDIS_MULTICAST_EXISTS: u32 = 0xc023000a; +pub const SMB_NTSTATUS_NDIS_MULTICAST_NOT_FOUND: u32 = 0xc023000b; +pub const SMB_NTSTATUS_NDIS_REQUEST_ABORTED: u32 = 0xc023000c; +pub const SMB_NTSTATUS_NDIS_RESET_IN_PROGRESS: u32 = 0xc023000d; +pub const SMB_NTSTATUS_NDIS_INVALID_PACKET: u32 = 0xc023000f; +pub const SMB_NTSTATUS_NDIS_INVALID_DEVICE_REQUEST: u32 = 0xc0230010; +pub const SMB_NTSTATUS_NDIS_ADAPTER_NOT_READY: u32 = 0xc0230011; +pub const SMB_NTSTATUS_NDIS_INVALID_LENGTH: u32 = 0xc0230014; +pub const SMB_NTSTATUS_NDIS_INVALID_DATA: u32 = 0xc0230015; +pub const SMB_NTSTATUS_NDIS_BUFFER_TOO_SHORT: u32 = 0xc0230016; +pub const SMB_NTSTATUS_NDIS_INVALID_OID: u32 = 0xc0230017; +pub const SMB_NTSTATUS_NDIS_ADAPTER_REMOVED: u32 = 0xc0230018; +pub const SMB_NTSTATUS_NDIS_UNSUPPORTED_MEDIA: u32 = 0xc0230019; +pub const SMB_NTSTATUS_NDIS_GROUP_ADDRESS_IN_USE: u32 = 0xc023001a; +pub const SMB_NTSTATUS_NDIS_FILE_NOT_FOUND: u32 = 0xc023001b; +pub const SMB_NTSTATUS_NDIS_ERROR_READING_FILE: u32 = 0xc023001c; +pub const SMB_NTSTATUS_NDIS_ALREADY_MAPPED: u32 = 0xc023001d; +pub const SMB_NTSTATUS_NDIS_RESOURCE_CONFLICT: u32 = 0xc023001e; +pub const SMB_NTSTATUS_NDIS_MEDIA_DISCONNECTED: u32 = 0xc023001f; +pub const SMB_NTSTATUS_NDIS_INVALID_ADDRESS: u32 = 0xc0230022; +pub const SMB_NTSTATUS_NDIS_PAUSED: u32 = 0xc023002a; +pub const SMB_NTSTATUS_NDIS_INTERFACE_NOT_FOUND: u32 = 0xc023002b; +pub const SMB_NTSTATUS_NDIS_UNSUPPORTED_REVISION: u32 = 0xc023002c; +pub const SMB_NTSTATUS_NDIS_INVALID_PORT: u32 = 0xc023002d; +pub const SMB_NTSTATUS_NDIS_INVALID_PORT_STATE: u32 = 0xc023002e; +pub const SMB_NTSTATUS_NDIS_LOW_POWER_STATE: u32 = 0xc023002f; +pub const SMB_NTSTATUS_NDIS_NOT_SUPPORTED: u32 = 0xc02300bb; +pub const SMB_NTSTATUS_NDIS_OFFLOAD_POLICY: u32 = 0xc023100f; +pub const SMB_NTSTATUS_NDIS_OFFLOAD_CONNECTION_REJECTED: u32 = 0xc0231012; +pub const SMB_NTSTATUS_NDIS_OFFLOAD_PATH_REJECTED: u32 = 0xc0231013; +pub const SMB_NTSTATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED: u32 = 0xc0232000; +pub const SMB_NTSTATUS_NDIS_DOT11_MEDIA_IN_USE: u32 = 0xc0232001; +pub const SMB_NTSTATUS_NDIS_DOT11_POWER_STATE_INVALID: u32 = 0xc0232002; +pub const SMB_NTSTATUS_NDIS_PM_WOL_PATTERN_LIST_FULL: u32 = 0xc0232003; +pub const SMB_NTSTATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: u32 = 0xc0232004; +pub const SMB_NTSTATUS_IPSEC_BAD_SPI: u32 = 0xc0360001; +pub const SMB_NTSTATUS_IPSEC_SA_LIFETIME_EXPIRED: u32 = 0xc0360002; +pub const SMB_NTSTATUS_IPSEC_WRONG_SA: u32 = 0xc0360003; +pub const SMB_NTSTATUS_IPSEC_REPLAY_CHECK_FAILED: u32 = 0xc0360004; +pub const SMB_NTSTATUS_IPSEC_INVALID_PACKET: u32 = 0xc0360005; +pub const SMB_NTSTATUS_IPSEC_INTEGRITY_CHECK_FAILED: u32 = 0xc0360006; +pub const SMB_NTSTATUS_IPSEC_CLEAR_TEXT_DROP: u32 = 0xc0360007; +pub const SMB_NTSTATUS_IPSEC_AUTH_FIREWALL_DROP: u32 = 0xc0360008; +pub const SMB_NTSTATUS_IPSEC_THROTTLE_DROP: u32 = 0xc0360009; +pub const SMB_NTSTATUS_IPSEC_DOSP_BLOCK: u32 = 0xc0368000; +pub const SMB_NTSTATUS_IPSEC_DOSP_RECEIVED_MULTICAST: u32 = 0xc0368001; +pub const SMB_NTSTATUS_IPSEC_DOSP_INVALID_PACKET: u32 = 0xc0368002; +pub const SMB_NTSTATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED: u32 = 0xc0368003; +pub const SMB_NTSTATUS_IPSEC_DOSP_MAX_ENTRIES: u32 = 0xc0368004; +pub const SMB_NTSTATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: u32 = 0xc0368005; +pub const SMB_NTSTATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: u32 = 0xc0368006; +pub const SMB_NTSTATUS_VOLMGR_MIRROR_NOT_SUPPORTED: u32 = 0xc038005b; +pub const SMB_NTSTATUS_VOLMGR_RAID5_NOT_SUPPORTED: u32 = 0xc038005c; +pub const SMB_NTSTATUS_VIRTDISK_PROVIDER_NOT_FOUND: u32 = 0xc03a0014; +pub const SMB_NTSTATUS_VIRTDISK_NOT_VIRTUAL_DISK: u32 = 0xc03a0015; +pub const SMB_NTSTATUS_VHD_PARENT_VHD_ACCESS_DENIED: u32 = 0xc03a0016; +pub const SMB_NTSTATUS_VHD_CHILD_PARENT_SIZE_MISMATCH: u32 = 0xc03a0017; +pub const SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: u32 = 0xc03a0018; +pub const SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: u32 = 0xc03a0019; pub fn smb_ntstatus_string(c: u32) -> Option<&'static str> { match c { - SMB_NTSTATUS_SUCCESS => Some("STATUS_SUCCESS"), - SMB_NTSTATUS_WAIT_1 => Some("STATUS_WAIT_1"), - SMB_NTSTATUS_WAIT_2 => Some("STATUS_WAIT_2"), - SMB_NTSTATUS_WAIT_3 => Some("STATUS_WAIT_3"), - SMB_NTSTATUS_WAIT_63 => Some("STATUS_WAIT_63"), - SMB_NTSTATUS_ABANDONED => Some("STATUS_ABANDONED"), - SMB_NTSTATUS_ABANDONED_WAIT_63 => Some("STATUS_ABANDONED_WAIT_63"), - SMB_NTSTATUS_USER_APC => Some("STATUS_USER_APC"), - SMB_NTSTATUS_ALERTED => Some("STATUS_ALERTED"), - SMB_NTSTATUS_TIMEOUT => Some("STATUS_TIMEOUT"), - SMB_NTSTATUS_PENDING => Some("STATUS_PENDING"), - SMB_NTSTATUS_REPARSE => Some("STATUS_REPARSE"), - SMB_NTSTATUS_MORE_ENTRIES => Some("STATUS_MORE_ENTRIES"), - SMB_NTSTATUS_NOT_ALL_ASSIGNED => Some("STATUS_NOT_ALL_ASSIGNED"), - SMB_NTSTATUS_SOME_NOT_MAPPED => Some("STATUS_SOME_NOT_MAPPED"), - SMB_NTSTATUS_OPLOCK_BREAK_IN_PROGRESS => Some("STATUS_OPLOCK_BREAK_IN_PROGRESS"), - SMB_NTSTATUS_VOLUME_MOUNTED => Some("STATUS_VOLUME_MOUNTED"), - SMB_NTSTATUS_RXACT_COMMITTED => Some("STATUS_RXACT_COMMITTED"), - SMB_NTSTATUS_NOTIFY_CLEANUP => Some("STATUS_NOTIFY_CLEANUP"), - SMB_NTSTATUS_NOTIFY_ENUM_DIR => Some("STATUS_NOTIFY_ENUM_DIR"), - SMB_NTSTATUS_NO_QUOTAS_FOR_ACCOUNT => Some("STATUS_NO_QUOTAS_FOR_ACCOUNT"), - SMB_NTSTATUS_PRIMARY_TRANSPORT_CONNECT_FAILED => Some("STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED"), - SMB_NTSTATUS_PAGE_FAULT_TRANSITION => Some("STATUS_PAGE_FAULT_TRANSITION"), - SMB_NTSTATUS_PAGE_FAULT_DEMAND_ZERO => Some("STATUS_PAGE_FAULT_DEMAND_ZERO"), - SMB_NTSTATUS_PAGE_FAULT_COPY_ON_WRITE => Some("STATUS_PAGE_FAULT_COPY_ON_WRITE"), - SMB_NTSTATUS_PAGE_FAULT_GUARD_PAGE => Some("STATUS_PAGE_FAULT_GUARD_PAGE"), - SMB_NTSTATUS_PAGE_FAULT_PAGING_FILE => Some("STATUS_PAGE_FAULT_PAGING_FILE"), - SMB_NTSTATUS_CACHE_PAGE_LOCKED => Some("STATUS_CACHE_PAGE_LOCKED"), - SMB_NTSTATUS_CRASH_DUMP => Some("STATUS_CRASH_DUMP"), - SMB_NTSTATUS_BUFFER_ALL_ZEROS => Some("STATUS_BUFFER_ALL_ZEROS"), - SMB_NTSTATUS_REPARSE_OBJECT => Some("STATUS_REPARSE_OBJECT"), - SMB_NTSTATUS_RESOURCE_REQUIREMENTS_CHANGED => Some("STATUS_RESOURCE_REQUIREMENTS_CHANGED"), - SMB_NTSTATUS_TRANSLATION_COMPLETE => Some("STATUS_TRANSLATION_COMPLETE"), - SMB_NTSTATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY => Some("STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY"), - SMB_NTSTATUS_NOTHING_TO_TERMINATE => Some("STATUS_NOTHING_TO_TERMINATE"), - SMB_NTSTATUS_PROCESS_NOT_IN_JOB => Some("STATUS_PROCESS_NOT_IN_JOB"), - SMB_NTSTATUS_PROCESS_IN_JOB => Some("STATUS_PROCESS_IN_JOB"), - SMB_NTSTATUS_VOLSNAP_HIBERNATE_READY => Some("STATUS_VOLSNAP_HIBERNATE_READY"), - SMB_NTSTATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY => Some("STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY"), - SMB_NTSTATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED => Some("STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED"), - SMB_NTSTATUS_INTERRUPT_STILL_CONNECTED => Some("STATUS_INTERRUPT_STILL_CONNECTED"), - SMB_NTSTATUS_PROCESS_CLONED => Some("STATUS_PROCESS_CLONED"), - SMB_NTSTATUS_FILE_LOCKED_WITH_ONLY_READERS => Some("STATUS_FILE_LOCKED_WITH_ONLY_READERS"), - SMB_NTSTATUS_FILE_LOCKED_WITH_WRITERS => Some("STATUS_FILE_LOCKED_WITH_WRITERS"), - SMB_NTSTATUS_RESOURCEMANAGER_READ_ONLY => Some("STATUS_RESOURCEMANAGER_READ_ONLY"), - SMB_NTSTATUS_WAIT_FOR_OPLOCK => Some("STATUS_WAIT_FOR_OPLOCK"), - SMB_NTDBG_EXCEPTION_HANDLED => Some("DBG_EXCEPTION_HANDLED"), - SMB_NTDBG_CONTINUE => Some("DBG_CONTINUE"), - SMB_NTSTATUS_FLT_IO_COMPLETE => Some("STATUS_FLT_IO_COMPLETE"), - SMB_NTSTATUS_FILE_NOT_AVAILABLE => Some("STATUS_FILE_NOT_AVAILABLE"), - SMB_NTSTATUS_SHARE_UNAVAILABLE => Some("STATUS_SHARE_UNAVAILABLE"), - SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_AFFINITY => Some("STATUS_CALLBACK_RETURNED_THREAD_AFFINITY"), - SMB_NTSTATUS_OBJECT_NAME_EXISTS => Some("STATUS_OBJECT_NAME_EXISTS"), - SMB_NTSTATUS_THREAD_WAS_SUSPENDED => Some("STATUS_THREAD_WAS_SUSPENDED"), - SMB_NTSTATUS_WORKING_SET_LIMIT_RANGE => Some("STATUS_WORKING_SET_LIMIT_RANGE"), - SMB_NTSTATUS_IMAGE_NOT_AT_BASE => Some("STATUS_IMAGE_NOT_AT_BASE"), - SMB_NTSTATUS_RXACT_STATE_CREATED => Some("STATUS_RXACT_STATE_CREATED"), - SMB_NTSTATUS_SEGMENT_NOTIFICATION => Some("STATUS_SEGMENT_NOTIFICATION"), - SMB_NTSTATUS_LOCAL_USER_SESSION_KEY => Some("STATUS_LOCAL_USER_SESSION_KEY"), - SMB_NTSTATUS_BAD_CURRENT_DIRECTORY => Some("STATUS_BAD_CURRENT_DIRECTORY"), - SMB_NTSTATUS_SERIAL_MORE_WRITES => Some("STATUS_SERIAL_MORE_WRITES"), - SMB_NTSTATUS_REGISTRY_RECOVERED => Some("STATUS_REGISTRY_RECOVERED"), - SMB_NTSTATUS_FT_READ_RECOVERY_FROM_BACKUP => Some("STATUS_FT_READ_RECOVERY_FROM_BACKUP"), - SMB_NTSTATUS_FT_WRITE_RECOVERY => Some("STATUS_FT_WRITE_RECOVERY"), - SMB_NTSTATUS_SERIAL_COUNTER_TIMEOUT => Some("STATUS_SERIAL_COUNTER_TIMEOUT"), - SMB_NTSTATUS_NULL_LM_PASSWORD => Some("STATUS_NULL_LM_PASSWORD"), - SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH => Some("STATUS_IMAGE_MACHINE_TYPE_MISMATCH"), - SMB_NTSTATUS_RECEIVE_PARTIAL => Some("STATUS_RECEIVE_PARTIAL"), - SMB_NTSTATUS_RECEIVE_EXPEDITED => Some("STATUS_RECEIVE_EXPEDITED"), - SMB_NTSTATUS_RECEIVE_PARTIAL_EXPEDITED => Some("STATUS_RECEIVE_PARTIAL_EXPEDITED"), - SMB_NTSTATUS_EVENT_DONE => Some("STATUS_EVENT_DONE"), - SMB_NTSTATUS_EVENT_PENDING => Some("STATUS_EVENT_PENDING"), - SMB_NTSTATUS_CHECKING_FILE_SYSTEM => Some("STATUS_CHECKING_FILE_SYSTEM"), - SMB_NTSTATUS_FATAL_APP_EXIT => Some("STATUS_FATAL_APP_EXIT"), - SMB_NTSTATUS_PREDEFINED_HANDLE => Some("STATUS_PREDEFINED_HANDLE"), - SMB_NTSTATUS_WAS_UNLOCKED => Some("STATUS_WAS_UNLOCKED"), - SMB_NTSTATUS_SERVICE_NOTIFICATION => Some("STATUS_SERVICE_NOTIFICATION"), - SMB_NTSTATUS_WAS_LOCKED => Some("STATUS_WAS_LOCKED"), - SMB_NTSTATUS_LOG_HARD_ERROR => Some("STATUS_LOG_HARD_ERROR"), - SMB_NTSTATUS_ALREADY_WIN32 => Some("STATUS_ALREADY_WIN32"), - SMB_NTSTATUS_WX86_UNSIMULATE => Some("STATUS_WX86_UNSIMULATE"), - SMB_NTSTATUS_WX86_CONTINUE => Some("STATUS_WX86_CONTINUE"), - SMB_NTSTATUS_WX86_SINGLE_STEP => Some("STATUS_WX86_SINGLE_STEP"), - SMB_NTSTATUS_WX86_BREAKPOINT => Some("STATUS_WX86_BREAKPOINT"), - SMB_NTSTATUS_WX86_EXCEPTION_CONTINUE => Some("STATUS_WX86_EXCEPTION_CONTINUE"), - SMB_NTSTATUS_WX86_EXCEPTION_LASTCHANCE => Some("STATUS_WX86_EXCEPTION_LASTCHANCE"), - SMB_NTSTATUS_WX86_EXCEPTION_CHAIN => Some("STATUS_WX86_EXCEPTION_CHAIN"), - SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE => Some("STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE"), - SMB_NTSTATUS_NO_YIELD_PERFORMED => Some("STATUS_NO_YIELD_PERFORMED"), - SMB_NTSTATUS_TIMER_RESUME_IGNORED => Some("STATUS_TIMER_RESUME_IGNORED"), - SMB_NTSTATUS_ARBITRATION_UNHANDLED => Some("STATUS_ARBITRATION_UNHANDLED"), - SMB_NTSTATUS_CARDBUS_NOT_SUPPORTED => Some("STATUS_CARDBUS_NOT_SUPPORTED"), - SMB_NTSTATUS_WX86_CREATEWX86TIB => Some("STATUS_WX86_CREATEWX86TIB"), - SMB_NTSTATUS_MP_PROCESSOR_MISMATCH => Some("STATUS_MP_PROCESSOR_MISMATCH"), - SMB_NTSTATUS_HIBERNATED => Some("STATUS_HIBERNATED"), - SMB_NTSTATUS_RESUME_HIBERNATION => Some("STATUS_RESUME_HIBERNATION"), - SMB_NTSTATUS_FIRMWARE_UPDATED => Some("STATUS_FIRMWARE_UPDATED"), - SMB_NTSTATUS_DRIVERS_LEAKING_LOCKED_PAGES => Some("STATUS_DRIVERS_LEAKING_LOCKED_PAGES"), - SMB_NTSTATUS_MESSAGE_RETRIEVED => Some("STATUS_MESSAGE_RETRIEVED"), - SMB_NTSTATUS_SYSTEM_POWERSTATE_TRANSITION => Some("STATUS_SYSTEM_POWERSTATE_TRANSITION"), - SMB_NTSTATUS_ALPC_CHECK_COMPLETION_LIST => Some("STATUS_ALPC_CHECK_COMPLETION_LIST"), - SMB_NTSTATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION => Some("STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION"), - SMB_NTSTATUS_ACCESS_AUDIT_BY_POLICY => Some("STATUS_ACCESS_AUDIT_BY_POLICY"), - SMB_NTSTATUS_ABANDON_HIBERFILE => Some("STATUS_ABANDON_HIBERFILE"), - SMB_NTSTATUS_BIZRULES_NOT_ENABLED => Some("STATUS_BIZRULES_NOT_ENABLED"), - SMB_NTSTATUS_WAKE_SYSTEM => Some("STATUS_WAKE_SYSTEM"), - SMB_NTSTATUS_DS_SHUTTING_DOWN => Some("STATUS_DS_SHUTTING_DOWN"), - SMB_NTDBG_REPLY_LATER => Some("DBG_REPLY_LATER"), - SMB_NTDBG_UNABLE_TO_PROVIDE_HANDLE => Some("DBG_UNABLE_TO_PROVIDE_HANDLE"), - SMB_NTDBG_TERMINATE_THREAD => Some("DBG_TERMINATE_THREAD"), - SMB_NTDBG_TERMINATE_PROCESS => Some("DBG_TERMINATE_PROCESS"), - SMB_NTDBG_CONTROL_C => Some("DBG_CONTROL_C"), - SMB_NTDBG_PRINTEXCEPTION_C => Some("DBG_PRINTEXCEPTION_C"), - SMB_NTDBG_RIPEXCEPTION => Some("DBG_RIPEXCEPTION"), - SMB_NTDBG_CONTROL_BREAK => Some("DBG_CONTROL_BREAK"), - SMB_NTDBG_COMMAND_EXCEPTION => Some("DBG_COMMAND_EXCEPTION"), - SMB_NTRPC_NT_UUID_LOCAL_ONLY => Some("RPC_NT_UUID_LOCAL_ONLY"), - SMB_NTRPC_NT_SEND_INCOMPLETE => Some("RPC_NT_SEND_INCOMPLETE"), - SMB_NTSTATUS_CTX_CDM_CONNECT => Some("STATUS_CTX_CDM_CONNECT"), - SMB_NTSTATUS_CTX_CDM_DISCONNECT => Some("STATUS_CTX_CDM_DISCONNECT"), - SMB_NTSTATUS_SXS_RELEASE_ACTIVATION_CONTEXT => Some("STATUS_SXS_RELEASE_ACTIVATION_CONTEXT"), - SMB_NTSTATUS_RECOVERY_NOT_NEEDED => Some("STATUS_RECOVERY_NOT_NEEDED"), - SMB_NTSTATUS_RM_ALREADY_STARTED => Some("STATUS_RM_ALREADY_STARTED"), - SMB_NTSTATUS_LOG_NO_RESTART => Some("STATUS_LOG_NO_RESTART"), - SMB_NTSTATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST => Some("STATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST"), - SMB_NTSTATUS_GRAPHICS_PARTIAL_DATA_POPULATED => Some("STATUS_GRAPHICS_PARTIAL_DATA_POPULATED"), - SMB_NTSTATUS_GRAPHICS_DRIVER_MISMATCH => Some("STATUS_GRAPHICS_DRIVER_MISMATCH"), - SMB_NTSTATUS_GRAPHICS_MODE_NOT_PINNED => Some("STATUS_GRAPHICS_MODE_NOT_PINNED"), - SMB_NTSTATUS_GRAPHICS_NO_PREFERRED_MODE => Some("STATUS_GRAPHICS_NO_PREFERRED_MODE"), - SMB_NTSTATUS_GRAPHICS_DATASET_IS_EMPTY => Some("STATUS_GRAPHICS_DATASET_IS_EMPTY"), - SMB_NTSTATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET => Some("STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET"), - SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED => Some("STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED"), - SMB_NTSTATUS_GRAPHICS_UNKNOWN_CHILD_STATUS => Some("STATUS_GRAPHICS_UNKNOWN_CHILD_STATUS"), - SMB_NTSTATUS_GRAPHICS_LEADLINK_START_DEFERRED => Some("STATUS_GRAPHICS_LEADLINK_START_DEFERRED"), - SMB_NTSTATUS_GRAPHICS_POLLING_TOO_FREQUENTLY => Some("STATUS_GRAPHICS_POLLING_TOO_FREQUENTLY"), - SMB_NTSTATUS_GRAPHICS_START_DEFERRED => Some("STATUS_GRAPHICS_START_DEFERRED"), - SMB_NTSTATUS_NDIS_INDICATION_REQUIRED => Some("STATUS_NDIS_INDICATION_REQUIRED"), - SMB_NTSTATUS_GUARD_PAGE_VIOLATION => Some("STATUS_GUARD_PAGE_VIOLATION"), - SMB_NTSTATUS_DATATYPE_MISALIGNMENT => Some("STATUS_DATATYPE_MISALIGNMENT"), - SMB_NTSTATUS_BREAKPOINT => Some("STATUS_BREAKPOINT"), - SMB_NTSTATUS_SINGLE_STEP => Some("STATUS_SINGLE_STEP"), - SMB_NTSTATUS_BUFFER_OVERFLOW => Some("STATUS_BUFFER_OVERFLOW"), - SMB_NTSTATUS_NO_MORE_FILES => Some("STATUS_NO_MORE_FILES"), - SMB_NTSTATUS_WAKE_SYSTEM_DEBUGGER => Some("STATUS_WAKE_SYSTEM_DEBUGGER"), - SMB_NTSTATUS_HANDLES_CLOSED => Some("STATUS_HANDLES_CLOSED"), - SMB_NTSTATUS_NO_INHERITANCE => Some("STATUS_NO_INHERITANCE"), - SMB_NTSTATUS_GUID_SUBSTITUTION_MADE => Some("STATUS_GUID_SUBSTITUTION_MADE"), - SMB_NTSTATUS_PARTIAL_COPY => Some("STATUS_PARTIAL_COPY"), - SMB_NTSTATUS_DEVICE_PAPER_EMPTY => Some("STATUS_DEVICE_PAPER_EMPTY"), - SMB_NTSTATUS_DEVICE_POWERED_OFF => Some("STATUS_DEVICE_POWERED_OFF"), - SMB_NTSTATUS_DEVICE_OFF_LINE => Some("STATUS_DEVICE_OFF_LINE"), - SMB_NTSTATUS_DEVICE_BUSY => Some("STATUS_DEVICE_BUSY"), - SMB_NTSTATUS_NO_MORE_EAS => Some("STATUS_NO_MORE_EAS"), - SMB_NTSTATUS_INVALID_EA_NAME => Some("STATUS_INVALID_EA_NAME"), - SMB_NTSTATUS_EA_LIST_INCONSISTENT => Some("STATUS_EA_LIST_INCONSISTENT"), - SMB_NTSTATUS_INVALID_EA_FLAG => Some("STATUS_INVALID_EA_FLAG"), - SMB_NTSTATUS_VERIFY_REQUIRED => Some("STATUS_VERIFY_REQUIRED"), - SMB_NTSTATUS_EXTRANEOUS_INFORMATION => Some("STATUS_EXTRANEOUS_INFORMATION"), - SMB_NTSTATUS_RXACT_COMMIT_NECESSARY => Some("STATUS_RXACT_COMMIT_NECESSARY"), - SMB_NTSTATUS_NO_MORE_ENTRIES => Some("STATUS_NO_MORE_ENTRIES"), - SMB_NTSTATUS_FILEMARK_DETECTED => Some("STATUS_FILEMARK_DETECTED"), - SMB_NTSTATUS_MEDIA_CHANGED => Some("STATUS_MEDIA_CHANGED"), - SMB_NTSTATUS_BUS_RESET => Some("STATUS_BUS_RESET"), - SMB_NTSTATUS_END_OF_MEDIA => Some("STATUS_END_OF_MEDIA"), - SMB_NTSTATUS_BEGINNING_OF_MEDIA => Some("STATUS_BEGINNING_OF_MEDIA"), - SMB_NTSTATUS_MEDIA_CHECK => Some("STATUS_MEDIA_CHECK"), - SMB_NTSTATUS_SETMARK_DETECTED => Some("STATUS_SETMARK_DETECTED"), - SMB_NTSTATUS_NO_DATA_DETECTED => Some("STATUS_NO_DATA_DETECTED"), - SMB_NTSTATUS_REDIRECTOR_HAS_OPEN_HANDLES => Some("STATUS_REDIRECTOR_HAS_OPEN_HANDLES"), - SMB_NTSTATUS_SERVER_HAS_OPEN_HANDLES => Some("STATUS_SERVER_HAS_OPEN_HANDLES"), - SMB_NTSTATUS_ALREADY_DISCONNECTED => Some("STATUS_ALREADY_DISCONNECTED"), - SMB_NTSTATUS_LONGJUMP => Some("STATUS_LONGJUMP"), - SMB_NTSTATUS_CLEANER_CARTRIDGE_INSTALLED => Some("STATUS_CLEANER_CARTRIDGE_INSTALLED"), - SMB_NTSTATUS_PLUGPLAY_QUERY_VETOED => Some("STATUS_PLUGPLAY_QUERY_VETOED"), - SMB_NTSTATUS_UNWIND_CONSOLIDATE => Some("STATUS_UNWIND_CONSOLIDATE"), - SMB_NTSTATUS_REGISTRY_HIVE_RECOVERED => Some("STATUS_REGISTRY_HIVE_RECOVERED"), - SMB_NTSTATUS_DLL_MIGHT_BE_INSECURE => Some("STATUS_DLL_MIGHT_BE_INSECURE"), - SMB_NTSTATUS_DLL_MIGHT_BE_INCOMPATIBLE => Some("STATUS_DLL_MIGHT_BE_INCOMPATIBLE"), - SMB_NTSTATUS_STOPPED_ON_SYMLINK => Some("STATUS_STOPPED_ON_SYMLINK"), - SMB_NTSTATUS_DEVICE_REQUIRES_CLEANING => Some("STATUS_DEVICE_REQUIRES_CLEANING"), - SMB_NTSTATUS_DEVICE_DOOR_OPEN => Some("STATUS_DEVICE_DOOR_OPEN"), - SMB_NTSTATUS_DATA_LOST_REPAIR => Some("STATUS_DATA_LOST_REPAIR"), - SMB_NTDBG_EXCEPTION_NOT_HANDLED => Some("DBG_EXCEPTION_NOT_HANDLED"), - SMB_NTSTATUS_CLUSTER_NODE_ALREADY_UP => Some("STATUS_CLUSTER_NODE_ALREADY_UP"), - SMB_NTSTATUS_CLUSTER_NODE_ALREADY_DOWN => Some("STATUS_CLUSTER_NODE_ALREADY_DOWN"), - SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_ONLINE => Some("STATUS_CLUSTER_NETWORK_ALREADY_ONLINE"), - SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_OFFLINE => Some("STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE"), - SMB_NTSTATUS_CLUSTER_NODE_ALREADY_MEMBER => Some("STATUS_CLUSTER_NODE_ALREADY_MEMBER"), - SMB_NTSTATUS_COULD_NOT_RESIZE_LOG => Some("STATUS_COULD_NOT_RESIZE_LOG"), - SMB_NTSTATUS_NO_TXF_METADATA => Some("STATUS_NO_TXF_METADATA"), - SMB_NTSTATUS_CANT_RECOVER_WITH_HANDLE_OPEN => Some("STATUS_CANT_RECOVER_WITH_HANDLE_OPEN"), - SMB_NTSTATUS_TXF_METADATA_ALREADY_PRESENT => Some("STATUS_TXF_METADATA_ALREADY_PRESENT"), - SMB_NTSTATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET => Some("STATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET"), - SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED => Some("STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED"), - SMB_NTSTATUS_FLT_BUFFER_TOO_SMALL => Some("STATUS_FLT_BUFFER_TOO_SMALL"), - SMB_NTSTATUS_FVE_PARTIAL_METADATA => Some("STATUS_FVE_PARTIAL_METADATA"), - SMB_NTSTATUS_FVE_TRANSIENT_STATE => Some("STATUS_FVE_TRANSIENT_STATE"), - SMB_NTSTATUS_UNSUCCESSFUL => Some("STATUS_UNSUCCESSFUL"), - SMB_NTSTATUS_NOT_IMPLEMENTED => Some("STATUS_NOT_IMPLEMENTED"), - SMB_NTSTATUS_INVALID_INFO_CLASS => Some("STATUS_INVALID_INFO_CLASS"), - SMB_NTSTATUS_INFO_LENGTH_MISMATCH => Some("STATUS_INFO_LENGTH_MISMATCH"), - SMB_NTSTATUS_ACCESS_VIOLATION => Some("STATUS_ACCESS_VIOLATION"), - SMB_NTSTATUS_IN_PAGE_ERROR => Some("STATUS_IN_PAGE_ERROR"), - SMB_NTSTATUS_PAGEFILE_QUOTA => Some("STATUS_PAGEFILE_QUOTA"), - SMB_NTSTATUS_INVALID_HANDLE => Some("STATUS_INVALID_HANDLE"), - SMB_NTSTATUS_BAD_INITIAL_STACK => Some("STATUS_BAD_INITIAL_STACK"), - SMB_NTSTATUS_BAD_INITIAL_PC => Some("STATUS_BAD_INITIAL_PC"), - SMB_NTSTATUS_INVALID_CID => Some("STATUS_INVALID_CID"), - SMB_NTSTATUS_TIMER_NOT_CANCELED => Some("STATUS_TIMER_NOT_CANCELED"), - SMB_NTSTATUS_INVALID_PARAMETER => Some("STATUS_INVALID_PARAMETER"), - SMB_NTSTATUS_NO_SUCH_DEVICE => Some("STATUS_NO_SUCH_DEVICE"), - SMB_NTSTATUS_NO_SUCH_FILE => Some("STATUS_NO_SUCH_FILE"), - SMB_NTSTATUS_INVALID_DEVICE_REQUEST => Some("STATUS_INVALID_DEVICE_REQUEST"), - SMB_NTSTATUS_END_OF_FILE => Some("STATUS_END_OF_FILE"), - SMB_NTSTATUS_WRONG_VOLUME => Some("STATUS_WRONG_VOLUME"), - SMB_NTSTATUS_NO_MEDIA_IN_DEVICE => Some("STATUS_NO_MEDIA_IN_DEVICE"), - SMB_NTSTATUS_UNRECOGNIZED_MEDIA => Some("STATUS_UNRECOGNIZED_MEDIA"), - SMB_NTSTATUS_NONEXISTENT_SECTOR => Some("STATUS_NONEXISTENT_SECTOR"), - SMB_NTSTATUS_MORE_PROCESSING_REQUIRED => Some("STATUS_MORE_PROCESSING_REQUIRED"), - SMB_NTSTATUS_NO_MEMORY => Some("STATUS_NO_MEMORY"), - SMB_NTSTATUS_CONFLICTING_ADDRESSES => Some("STATUS_CONFLICTING_ADDRESSES"), - SMB_NTSTATUS_NOT_MAPPED_VIEW => Some("STATUS_NOT_MAPPED_VIEW"), - SMB_NTSTATUS_UNABLE_TO_FREE_VM => Some("STATUS_UNABLE_TO_FREE_VM"), - SMB_NTSTATUS_UNABLE_TO_DELETE_SECTION => Some("STATUS_UNABLE_TO_DELETE_SECTION"), - SMB_NTSTATUS_INVALID_SYSTEM_SERVICE => Some("STATUS_INVALID_SYSTEM_SERVICE"), - SMB_NTSTATUS_ILLEGAL_INSTRUCTION => Some("STATUS_ILLEGAL_INSTRUCTION"), - SMB_NTSTATUS_INVALID_LOCK_SEQUENCE => Some("STATUS_INVALID_LOCK_SEQUENCE"), - SMB_NTSTATUS_INVALID_VIEW_SIZE => Some("STATUS_INVALID_VIEW_SIZE"), - SMB_NTSTATUS_INVALID_FILE_FOR_SECTION => Some("STATUS_INVALID_FILE_FOR_SECTION"), - SMB_NTSTATUS_ALREADY_COMMITTED => Some("STATUS_ALREADY_COMMITTED"), - SMB_NTSTATUS_ACCESS_DENIED => Some("STATUS_ACCESS_DENIED"), - SMB_NTSTATUS_BUFFER_TOO_SMALL => Some("STATUS_BUFFER_TOO_SMALL"), - SMB_NTSTATUS_OBJECT_TYPE_MISMATCH => Some("STATUS_OBJECT_TYPE_MISMATCH"), - SMB_NTSTATUS_NONCONTINUABLE_EXCEPTION => Some("STATUS_NONCONTINUABLE_EXCEPTION"), - SMB_NTSTATUS_INVALID_DISPOSITION => Some("STATUS_INVALID_DISPOSITION"), - SMB_NTSTATUS_UNWIND => Some("STATUS_UNWIND"), - SMB_NTSTATUS_BAD_STACK => Some("STATUS_BAD_STACK"), - SMB_NTSTATUS_INVALID_UNWIND_TARGET => Some("STATUS_INVALID_UNWIND_TARGET"), - SMB_NTSTATUS_NOT_LOCKED => Some("STATUS_NOT_LOCKED"), - SMB_NTSTATUS_PARITY_ERROR => Some("STATUS_PARITY_ERROR"), - SMB_NTSTATUS_UNABLE_TO_DECOMMIT_VM => Some("STATUS_UNABLE_TO_DECOMMIT_VM"), - SMB_NTSTATUS_NOT_COMMITTED => Some("STATUS_NOT_COMMITTED"), - SMB_NTSTATUS_INVALID_PORT_ATTRIBUTES => Some("STATUS_INVALID_PORT_ATTRIBUTES"), - SMB_NTSTATUS_PORT_MESSAGE_TOO_LONG => Some("STATUS_PORT_MESSAGE_TOO_LONG"), - SMB_NTSTATUS_INVALID_PARAMETER_MIX => Some("STATUS_INVALID_PARAMETER_MIX"), - SMB_NTSTATUS_INVALID_QUOTA_LOWER => Some("STATUS_INVALID_QUOTA_LOWER"), - SMB_NTSTATUS_DISK_CORRUPT_ERROR => Some("STATUS_DISK_CORRUPT_ERROR"), - SMB_NTSTATUS_OBJECT_NAME_INVALID => Some("STATUS_OBJECT_NAME_INVALID"), - SMB_NTSTATUS_OBJECT_NAME_NOT_FOUND => Some("STATUS_OBJECT_NAME_NOT_FOUND"), - SMB_NTSTATUS_OBJECT_NAME_COLLISION => Some("STATUS_OBJECT_NAME_COLLISION"), - SMB_NTSTATUS_PORT_DISCONNECTED => Some("STATUS_PORT_DISCONNECTED"), - SMB_NTSTATUS_DEVICE_ALREADY_ATTACHED => Some("STATUS_DEVICE_ALREADY_ATTACHED"), - SMB_NTSTATUS_OBJECT_PATH_INVALID => Some("STATUS_OBJECT_PATH_INVALID"), - SMB_NTSTATUS_OBJECT_PATH_NOT_FOUND => Some("STATUS_OBJECT_PATH_NOT_FOUND"), - SMB_NTSTATUS_OBJECT_PATH_SYNTAX_BAD => Some("STATUS_OBJECT_PATH_SYNTAX_BAD"), - SMB_NTSTATUS_DATA_OVERRUN => Some("STATUS_DATA_OVERRUN"), - SMB_NTSTATUS_DATA_LATE_ERROR => Some("STATUS_DATA_LATE_ERROR"), - SMB_NTSTATUS_DATA_ERROR => Some("STATUS_DATA_ERROR"), - SMB_NTSTATUS_CRC_ERROR => Some("STATUS_CRC_ERROR"), - SMB_NTSTATUS_SECTION_TOO_BIG => Some("STATUS_SECTION_TOO_BIG"), - SMB_NTSTATUS_PORT_CONNECTION_REFUSED => Some("STATUS_PORT_CONNECTION_REFUSED"), - SMB_NTSTATUS_INVALID_PORT_HANDLE => Some("STATUS_INVALID_PORT_HANDLE"), - SMB_NTSTATUS_SHARING_VIOLATION => Some("STATUS_SHARING_VIOLATION"), - SMB_NTSTATUS_QUOTA_EXCEEDED => Some("STATUS_QUOTA_EXCEEDED"), - SMB_NTSTATUS_INVALID_PAGE_PROTECTION => Some("STATUS_INVALID_PAGE_PROTECTION"), - SMB_NTSTATUS_MUTANT_NOT_OWNED => Some("STATUS_MUTANT_NOT_OWNED"), - SMB_NTSTATUS_SEMAPHORE_LIMIT_EXCEEDED => Some("STATUS_SEMAPHORE_LIMIT_EXCEEDED"), - SMB_NTSTATUS_PORT_ALREADY_SET => Some("STATUS_PORT_ALREADY_SET"), - SMB_NTSTATUS_SECTION_NOT_IMAGE => Some("STATUS_SECTION_NOT_IMAGE"), - SMB_NTSTATUS_SUSPEND_COUNT_EXCEEDED => Some("STATUS_SUSPEND_COUNT_EXCEEDED"), - SMB_NTSTATUS_THREAD_IS_TERMINATING => Some("STATUS_THREAD_IS_TERMINATING"), - SMB_NTSTATUS_BAD_WORKING_SET_LIMIT => Some("STATUS_BAD_WORKING_SET_LIMIT"), - SMB_NTSTATUS_INCOMPATIBLE_FILE_MAP => Some("STATUS_INCOMPATIBLE_FILE_MAP"), - SMB_NTSTATUS_SECTION_PROTECTION => Some("STATUS_SECTION_PROTECTION"), - SMB_NTSTATUS_EAS_NOT_SUPPORTED => Some("STATUS_EAS_NOT_SUPPORTED"), - SMB_NTSTATUS_EA_TOO_LARGE => Some("STATUS_EA_TOO_LARGE"), - SMB_NTSTATUS_NONEXISTENT_EA_ENTRY => Some("STATUS_NONEXISTENT_EA_ENTRY"), - SMB_NTSTATUS_NO_EAS_ON_FILE => Some("STATUS_NO_EAS_ON_FILE"), - SMB_NTSTATUS_EA_CORRUPT_ERROR => Some("STATUS_EA_CORRUPT_ERROR"), - SMB_NTSTATUS_FILE_LOCK_CONFLICT => Some("STATUS_FILE_LOCK_CONFLICT"), - SMB_NTSTATUS_LOCK_NOT_GRANTED => Some("STATUS_LOCK_NOT_GRANTED"), - SMB_NTSTATUS_DELETE_PENDING => Some("STATUS_DELETE_PENDING"), - SMB_NTSTATUS_CTL_FILE_NOT_SUPPORTED => Some("STATUS_CTL_FILE_NOT_SUPPORTED"), - SMB_NTSTATUS_UNKNOWN_REVISION => Some("STATUS_UNKNOWN_REVISION"), - SMB_NTSTATUS_REVISION_MISMATCH => Some("STATUS_REVISION_MISMATCH"), - SMB_NTSTATUS_INVALID_OWNER => Some("STATUS_INVALID_OWNER"), - SMB_NTSTATUS_INVALID_PRIMARY_GROUP => Some("STATUS_INVALID_PRIMARY_GROUP"), - SMB_NTSTATUS_NO_IMPERSONATION_TOKEN => Some("STATUS_NO_IMPERSONATION_TOKEN"), - SMB_NTSTATUS_CANT_DISABLE_MANDATORY => Some("STATUS_CANT_DISABLE_MANDATORY"), - SMB_NTSTATUS_NO_LOGON_SERVERS => Some("STATUS_NO_LOGON_SERVERS"), - SMB_NTSTATUS_NO_SUCH_LOGON_SESSION => Some("STATUS_NO_SUCH_LOGON_SESSION"), - SMB_NTSTATUS_NO_SUCH_PRIVILEGE => Some("STATUS_NO_SUCH_PRIVILEGE"), - SMB_NTSTATUS_PRIVILEGE_NOT_HELD => Some("STATUS_PRIVILEGE_NOT_HELD"), - SMB_NTSTATUS_INVALID_ACCOUNT_NAME => Some("STATUS_INVALID_ACCOUNT_NAME"), - SMB_NTSTATUS_USER_EXISTS => Some("STATUS_USER_EXISTS"), - SMB_NTSTATUS_NO_SUCH_USER => Some("STATUS_NO_SUCH_USER"), - SMB_NTSTATUS_GROUP_EXISTS => Some("STATUS_GROUP_EXISTS"), - SMB_NTSTATUS_NO_SUCH_GROUP => Some("STATUS_NO_SUCH_GROUP"), - SMB_NTSTATUS_MEMBER_IN_GROUP => Some("STATUS_MEMBER_IN_GROUP"), - SMB_NTSTATUS_MEMBER_NOT_IN_GROUP => Some("STATUS_MEMBER_NOT_IN_GROUP"), - SMB_NTSTATUS_LAST_ADMIN => Some("STATUS_LAST_ADMIN"), - SMB_NTSTATUS_WRONG_PASSWORD => Some("STATUS_WRONG_PASSWORD"), - SMB_NTSTATUS_ILL_FORMED_PASSWORD => Some("STATUS_ILL_FORMED_PASSWORD"), - SMB_NTSTATUS_PASSWORD_RESTRICTION => Some("STATUS_PASSWORD_RESTRICTION"), - SMB_NTSTATUS_LOGON_FAILURE => Some("STATUS_LOGON_FAILURE"), - SMB_NTSTATUS_ACCOUNT_RESTRICTION => Some("STATUS_ACCOUNT_RESTRICTION"), - SMB_NTSTATUS_INVALID_LOGON_HOURS => Some("STATUS_INVALID_LOGON_HOURS"), - SMB_NTSTATUS_INVALID_WORKSTATION => Some("STATUS_INVALID_WORKSTATION"), - SMB_NTSTATUS_PASSWORD_EXPIRED => Some("STATUS_PASSWORD_EXPIRED"), - SMB_NTSTATUS_ACCOUNT_DISABLED => Some("STATUS_ACCOUNT_DISABLED"), - SMB_NTSTATUS_NONE_MAPPED => Some("STATUS_NONE_MAPPED"), - SMB_NTSTATUS_TOO_MANY_LUIDS_REQUESTED => Some("STATUS_TOO_MANY_LUIDS_REQUESTED"), - SMB_NTSTATUS_LUIDS_EXHAUSTED => Some("STATUS_LUIDS_EXHAUSTED"), - SMB_NTSTATUS_INVALID_SUB_AUTHORITY => Some("STATUS_INVALID_SUB_AUTHORITY"), - SMB_NTSTATUS_INVALID_ACL => Some("STATUS_INVALID_ACL"), - SMB_NTSTATUS_INVALID_SID => Some("STATUS_INVALID_SID"), - SMB_NTSTATUS_INVALID_SECURITY_DESCR => Some("STATUS_INVALID_SECURITY_DESCR"), - SMB_NTSTATUS_PROCEDURE_NOT_FOUND => Some("STATUS_PROCEDURE_NOT_FOUND"), - SMB_NTSTATUS_INVALID_IMAGE_FORMAT => Some("STATUS_INVALID_IMAGE_FORMAT"), - SMB_NTSTATUS_NO_TOKEN => Some("STATUS_NO_TOKEN"), - SMB_NTSTATUS_BAD_INHERITANCE_ACL => Some("STATUS_BAD_INHERITANCE_ACL"), - SMB_NTSTATUS_RANGE_NOT_LOCKED => Some("STATUS_RANGE_NOT_LOCKED"), - SMB_NTSTATUS_DISK_FULL => Some("STATUS_DISK_FULL"), - SMB_NTSTATUS_SERVER_DISABLED => Some("STATUS_SERVER_DISABLED"), - SMB_NTSTATUS_SERVER_NOT_DISABLED => Some("STATUS_SERVER_NOT_DISABLED"), - SMB_NTSTATUS_TOO_MANY_GUIDS_REQUESTED => Some("STATUS_TOO_MANY_GUIDS_REQUESTED"), - SMB_NTSTATUS_GUIDS_EXHAUSTED => Some("STATUS_GUIDS_EXHAUSTED"), - SMB_NTSTATUS_INVALID_ID_AUTHORITY => Some("STATUS_INVALID_ID_AUTHORITY"), - SMB_NTSTATUS_AGENTS_EXHAUSTED => Some("STATUS_AGENTS_EXHAUSTED"), - SMB_NTSTATUS_INVALID_VOLUME_LABEL => Some("STATUS_INVALID_VOLUME_LABEL"), - SMB_NTSTATUS_SECTION_NOT_EXTENDED => Some("STATUS_SECTION_NOT_EXTENDED"), - SMB_NTSTATUS_NOT_MAPPED_DATA => Some("STATUS_NOT_MAPPED_DATA"), - SMB_NTSTATUS_RESOURCE_DATA_NOT_FOUND => Some("STATUS_RESOURCE_DATA_NOT_FOUND"), - SMB_NTSTATUS_RESOURCE_TYPE_NOT_FOUND => Some("STATUS_RESOURCE_TYPE_NOT_FOUND"), - SMB_NTSTATUS_RESOURCE_NAME_NOT_FOUND => Some("STATUS_RESOURCE_NAME_NOT_FOUND"), - SMB_NTSTATUS_ARRAY_BOUNDS_EXCEEDED => Some("STATUS_ARRAY_BOUNDS_EXCEEDED"), - SMB_NTSTATUS_FLOAT_DENORMAL_OPERAND => Some("STATUS_FLOAT_DENORMAL_OPERAND"), - SMB_NTSTATUS_FLOAT_DIVIDE_BY_ZERO => Some("STATUS_FLOAT_DIVIDE_BY_ZERO"), - SMB_NTSTATUS_FLOAT_INEXACT_RESULT => Some("STATUS_FLOAT_INEXACT_RESULT"), - SMB_NTSTATUS_FLOAT_INVALID_OPERATION => Some("STATUS_FLOAT_INVALID_OPERATION"), - SMB_NTSTATUS_FLOAT_OVERFLOW => Some("STATUS_FLOAT_OVERFLOW"), - SMB_NTSTATUS_FLOAT_STACK_CHECK => Some("STATUS_FLOAT_STACK_CHECK"), - SMB_NTSTATUS_FLOAT_UNDERFLOW => Some("STATUS_FLOAT_UNDERFLOW"), - SMB_NTSTATUS_INTEGER_DIVIDE_BY_ZERO => Some("STATUS_INTEGER_DIVIDE_BY_ZERO"), - SMB_NTSTATUS_INTEGER_OVERFLOW => Some("STATUS_INTEGER_OVERFLOW"), - SMB_NTSTATUS_PRIVILEGED_INSTRUCTION => Some("STATUS_PRIVILEGED_INSTRUCTION"), - SMB_NTSTATUS_TOO_MANY_PAGING_FILES => Some("STATUS_TOO_MANY_PAGING_FILES"), - SMB_NTSTATUS_FILE_INVALID => Some("STATUS_FILE_INVALID"), - SMB_NTSTATUS_ALLOTTED_SPACE_EXCEEDED => Some("STATUS_ALLOTTED_SPACE_EXCEEDED"), - SMB_NTSTATUS_INSUFFICIENT_RESOURCES => Some("STATUS_INSUFFICIENT_RESOURCES"), - SMB_NTSTATUS_DFS_EXIT_PATH_FOUND => Some("STATUS_DFS_EXIT_PATH_FOUND"), - SMB_NTSTATUS_DEVICE_DATA_ERROR => Some("STATUS_DEVICE_DATA_ERROR"), - SMB_NTSTATUS_DEVICE_NOT_CONNECTED => Some("STATUS_DEVICE_NOT_CONNECTED"), - SMB_NTSTATUS_FREE_VM_NOT_AT_BASE => Some("STATUS_FREE_VM_NOT_AT_BASE"), - SMB_NTSTATUS_MEMORY_NOT_ALLOCATED => Some("STATUS_MEMORY_NOT_ALLOCATED"), - SMB_NTSTATUS_WORKING_SET_QUOTA => Some("STATUS_WORKING_SET_QUOTA"), - SMB_NTSTATUS_MEDIA_WRITE_PROTECTED => Some("STATUS_MEDIA_WRITE_PROTECTED"), - SMB_NTSTATUS_DEVICE_NOT_READY => Some("STATUS_DEVICE_NOT_READY"), - SMB_NTSTATUS_INVALID_GROUP_ATTRIBUTES => Some("STATUS_INVALID_GROUP_ATTRIBUTES"), - SMB_NTSTATUS_BAD_IMPERSONATION_LEVEL => Some("STATUS_BAD_IMPERSONATION_LEVEL"), - SMB_NTSTATUS_CANT_OPEN_ANONYMOUS => Some("STATUS_CANT_OPEN_ANONYMOUS"), - SMB_NTSTATUS_BAD_VALIDATION_CLASS => Some("STATUS_BAD_VALIDATION_CLASS"), - SMB_NTSTATUS_BAD_TOKEN_TYPE => Some("STATUS_BAD_TOKEN_TYPE"), - SMB_NTSTATUS_BAD_MASTER_BOOT_RECORD => Some("STATUS_BAD_MASTER_BOOT_RECORD"), - SMB_NTSTATUS_INSTRUCTION_MISALIGNMENT => Some("STATUS_INSTRUCTION_MISALIGNMENT"), - SMB_NTSTATUS_INSTANCE_NOT_AVAILABLE => Some("STATUS_INSTANCE_NOT_AVAILABLE"), - SMB_NTSTATUS_PIPE_NOT_AVAILABLE => Some("STATUS_PIPE_NOT_AVAILABLE"), - SMB_NTSTATUS_INVALID_PIPE_STATE => Some("STATUS_INVALID_PIPE_STATE"), - SMB_NTSTATUS_PIPE_BUSY => Some("STATUS_PIPE_BUSY"), - SMB_NTSTATUS_ILLEGAL_FUNCTION => Some("STATUS_ILLEGAL_FUNCTION"), - SMB_NTSTATUS_PIPE_DISCONNECTED => Some("STATUS_PIPE_DISCONNECTED"), - SMB_NTSTATUS_PIPE_CLOSING => Some("STATUS_PIPE_CLOSING"), - SMB_NTSTATUS_PIPE_CONNECTED => Some("STATUS_PIPE_CONNECTED"), - SMB_NTSTATUS_PIPE_LISTENING => Some("STATUS_PIPE_LISTENING"), - SMB_NTSTATUS_INVALID_READ_MODE => Some("STATUS_INVALID_READ_MODE"), - SMB_NTSTATUS_IO_TIMEOUT => Some("STATUS_IO_TIMEOUT"), - SMB_NTSTATUS_FILE_FORCED_CLOSED => Some("STATUS_FILE_FORCED_CLOSED"), - SMB_NTSTATUS_PROFILING_NOT_STARTED => Some("STATUS_PROFILING_NOT_STARTED"), - SMB_NTSTATUS_PROFILING_NOT_STOPPED => Some("STATUS_PROFILING_NOT_STOPPED"), - SMB_NTSTATUS_COULD_NOT_INTERPRET => Some("STATUS_COULD_NOT_INTERPRET"), - SMB_NTSTATUS_FILE_IS_A_DIRECTORY => Some("STATUS_FILE_IS_A_DIRECTORY"), - SMB_NTSTATUS_NOT_SUPPORTED => Some("STATUS_NOT_SUPPORTED"), - SMB_NTSTATUS_REMOTE_NOT_LISTENING => Some("STATUS_REMOTE_NOT_LISTENING"), - SMB_NTSTATUS_DUPLICATE_NAME => Some("STATUS_DUPLICATE_NAME"), - SMB_NTSTATUS_BAD_NETWORK_PATH => Some("STATUS_BAD_NETWORK_PATH"), - SMB_NTSTATUS_NETWORK_BUSY => Some("STATUS_NETWORK_BUSY"), - SMB_NTSTATUS_DEVICE_DOES_NOT_EXIST => Some("STATUS_DEVICE_DOES_NOT_EXIST"), - SMB_NTSTATUS_TOO_MANY_COMMANDS => Some("STATUS_TOO_MANY_COMMANDS"), - SMB_NTSTATUS_ADAPTER_HARDWARE_ERROR => Some("STATUS_ADAPTER_HARDWARE_ERROR"), - SMB_NTSTATUS_INVALID_NETWORK_RESPONSE => Some("STATUS_INVALID_NETWORK_RESPONSE"), - SMB_NTSTATUS_UNEXPECTED_NETWORK_ERROR => Some("STATUS_UNEXPECTED_NETWORK_ERROR"), - SMB_NTSTATUS_BAD_REMOTE_ADAPTER => Some("STATUS_BAD_REMOTE_ADAPTER"), - SMB_NTSTATUS_PRINT_QUEUE_FULL => Some("STATUS_PRINT_QUEUE_FULL"), - SMB_NTSTATUS_NO_SPOOL_SPACE => Some("STATUS_NO_SPOOL_SPACE"), - SMB_NTSTATUS_PRINT_CANCELLED => Some("STATUS_PRINT_CANCELLED"), - SMB_NTSTATUS_NETWORK_NAME_DELETED => Some("STATUS_NETWORK_NAME_DELETED"), - SMB_NTSTATUS_NETWORK_ACCESS_DENIED => Some("STATUS_NETWORK_ACCESS_DENIED"), - SMB_NTSTATUS_BAD_DEVICE_TYPE => Some("STATUS_BAD_DEVICE_TYPE"), - SMB_NTSTATUS_BAD_NETWORK_NAME => Some("STATUS_BAD_NETWORK_NAME"), - SMB_NTSTATUS_TOO_MANY_NAMES => Some("STATUS_TOO_MANY_NAMES"), - SMB_NTSTATUS_TOO_MANY_SESSIONS => Some("STATUS_TOO_MANY_SESSIONS"), - SMB_NTSTATUS_SHARING_PAUSED => Some("STATUS_SHARING_PAUSED"), - SMB_NTSTATUS_REQUEST_NOT_ACCEPTED => Some("STATUS_REQUEST_NOT_ACCEPTED"), - SMB_NTSTATUS_REDIRECTOR_PAUSED => Some("STATUS_REDIRECTOR_PAUSED"), - SMB_NTSTATUS_NET_WRITE_FAULT => Some("STATUS_NET_WRITE_FAULT"), - SMB_NTSTATUS_PROFILING_AT_LIMIT => Some("STATUS_PROFILING_AT_LIMIT"), - SMB_NTSTATUS_NOT_SAME_DEVICE => Some("STATUS_NOT_SAME_DEVICE"), - SMB_NTSTATUS_FILE_RENAMED => Some("STATUS_FILE_RENAMED"), - SMB_NTSTATUS_VIRTUAL_CIRCUIT_CLOSED => Some("STATUS_VIRTUAL_CIRCUIT_CLOSED"), - SMB_NTSTATUS_NO_SECURITY_ON_OBJECT => Some("STATUS_NO_SECURITY_ON_OBJECT"), - SMB_NTSTATUS_CANT_WAIT => Some("STATUS_CANT_WAIT"), - SMB_NTSTATUS_PIPE_EMPTY => Some("STATUS_PIPE_EMPTY"), - SMB_NTSTATUS_CANT_ACCESS_DOMAIN_INFO => Some("STATUS_CANT_ACCESS_DOMAIN_INFO"), - SMB_NTSTATUS_CANT_TERMINATE_SELF => Some("STATUS_CANT_TERMINATE_SELF"), - SMB_NTSTATUS_INVALID_SERVER_STATE => Some("STATUS_INVALID_SERVER_STATE"), - SMB_NTSTATUS_INVALID_DOMAIN_STATE => Some("STATUS_INVALID_DOMAIN_STATE"), - SMB_NTSTATUS_INVALID_DOMAIN_ROLE => Some("STATUS_INVALID_DOMAIN_ROLE"), - SMB_NTSTATUS_NO_SUCH_DOMAIN => Some("STATUS_NO_SUCH_DOMAIN"), - SMB_NTSTATUS_DOMAIN_EXISTS => Some("STATUS_DOMAIN_EXISTS"), - SMB_NTSTATUS_DOMAIN_LIMIT_EXCEEDED => Some("STATUS_DOMAIN_LIMIT_EXCEEDED"), - SMB_NTSTATUS_OPLOCK_NOT_GRANTED => Some("STATUS_OPLOCK_NOT_GRANTED"), - SMB_NTSTATUS_INVALID_OPLOCK_PROTOCOL => Some("STATUS_INVALID_OPLOCK_PROTOCOL"), - SMB_NTSTATUS_INTERNAL_DB_CORRUPTION => Some("STATUS_INTERNAL_DB_CORRUPTION"), - SMB_NTSTATUS_INTERNAL_ERROR => Some("STATUS_INTERNAL_ERROR"), - SMB_NTSTATUS_GENERIC_NOT_MAPPED => Some("STATUS_GENERIC_NOT_MAPPED"), - SMB_NTSTATUS_BAD_DESCRIPTOR_FORMAT => Some("STATUS_BAD_DESCRIPTOR_FORMAT"), - SMB_NTSTATUS_INVALID_USER_BUFFER => Some("STATUS_INVALID_USER_BUFFER"), - SMB_NTSTATUS_UNEXPECTED_IO_ERROR => Some("STATUS_UNEXPECTED_IO_ERROR"), - SMB_NTSTATUS_UNEXPECTED_MM_CREATE_ERR => Some("STATUS_UNEXPECTED_MM_CREATE_ERR"), - SMB_NTSTATUS_UNEXPECTED_MM_MAP_ERROR => Some("STATUS_UNEXPECTED_MM_MAP_ERROR"), - SMB_NTSTATUS_UNEXPECTED_MM_EXTEND_ERR => Some("STATUS_UNEXPECTED_MM_EXTEND_ERR"), - SMB_NTSTATUS_NOT_LOGON_PROCESS => Some("STATUS_NOT_LOGON_PROCESS"), - SMB_NTSTATUS_LOGON_SESSION_EXISTS => Some("STATUS_LOGON_SESSION_EXISTS"), - SMB_NTSTATUS_INVALID_PARAMETER_1 => Some("STATUS_INVALID_PARAMETER_1"), - SMB_NTSTATUS_INVALID_PARAMETER_2 => Some("STATUS_INVALID_PARAMETER_2"), - SMB_NTSTATUS_INVALID_PARAMETER_3 => Some("STATUS_INVALID_PARAMETER_3"), - SMB_NTSTATUS_INVALID_PARAMETER_4 => Some("STATUS_INVALID_PARAMETER_4"), - SMB_NTSTATUS_INVALID_PARAMETER_5 => Some("STATUS_INVALID_PARAMETER_5"), - SMB_NTSTATUS_INVALID_PARAMETER_6 => Some("STATUS_INVALID_PARAMETER_6"), - SMB_NTSTATUS_INVALID_PARAMETER_7 => Some("STATUS_INVALID_PARAMETER_7"), - SMB_NTSTATUS_INVALID_PARAMETER_8 => Some("STATUS_INVALID_PARAMETER_8"), - SMB_NTSTATUS_INVALID_PARAMETER_9 => Some("STATUS_INVALID_PARAMETER_9"), - SMB_NTSTATUS_INVALID_PARAMETER_10 => Some("STATUS_INVALID_PARAMETER_10"), - SMB_NTSTATUS_INVALID_PARAMETER_11 => Some("STATUS_INVALID_PARAMETER_11"), - SMB_NTSTATUS_INVALID_PARAMETER_12 => Some("STATUS_INVALID_PARAMETER_12"), - SMB_NTSTATUS_REDIRECTOR_NOT_STARTED => Some("STATUS_REDIRECTOR_NOT_STARTED"), - SMB_NTSTATUS_REDIRECTOR_STARTED => Some("STATUS_REDIRECTOR_STARTED"), - SMB_NTSTATUS_STACK_OVERFLOW => Some("STATUS_STACK_OVERFLOW"), - SMB_NTSTATUS_NO_SUCH_PACKAGE => Some("STATUS_NO_SUCH_PACKAGE"), - SMB_NTSTATUS_BAD_FUNCTION_TABLE => Some("STATUS_BAD_FUNCTION_TABLE"), - SMB_NTSTATUS_VARIABLE_NOT_FOUND => Some("STATUS_VARIABLE_NOT_FOUND"), - SMB_NTSTATUS_DIRECTORY_NOT_EMPTY => Some("STATUS_DIRECTORY_NOT_EMPTY"), - SMB_NTSTATUS_FILE_CORRUPT_ERROR => Some("STATUS_FILE_CORRUPT_ERROR"), - SMB_NTSTATUS_NOT_A_DIRECTORY => Some("STATUS_NOT_A_DIRECTORY"), - SMB_NTSTATUS_BAD_LOGON_SESSION_STATE => Some("STATUS_BAD_LOGON_SESSION_STATE"), - SMB_NTSTATUS_LOGON_SESSION_COLLISION => Some("STATUS_LOGON_SESSION_COLLISION"), - SMB_NTSTATUS_NAME_TOO_LONG => Some("STATUS_NAME_TOO_LONG"), - SMB_NTSTATUS_FILES_OPEN => Some("STATUS_FILES_OPEN"), - SMB_NTSTATUS_CONNECTION_IN_USE => Some("STATUS_CONNECTION_IN_USE"), - SMB_NTSTATUS_MESSAGE_NOT_FOUND => Some("STATUS_MESSAGE_NOT_FOUND"), - SMB_NTSTATUS_PROCESS_IS_TERMINATING => Some("STATUS_PROCESS_IS_TERMINATING"), - SMB_NTSTATUS_INVALID_LOGON_TYPE => Some("STATUS_INVALID_LOGON_TYPE"), - SMB_NTSTATUS_NO_GUID_TRANSLATION => Some("STATUS_NO_GUID_TRANSLATION"), - SMB_NTSTATUS_CANNOT_IMPERSONATE => Some("STATUS_CANNOT_IMPERSONATE"), - SMB_NTSTATUS_IMAGE_ALREADY_LOADED => Some("STATUS_IMAGE_ALREADY_LOADED"), - SMB_NTSTATUS_NO_LDT => Some("STATUS_NO_LDT"), - SMB_NTSTATUS_INVALID_LDT_SIZE => Some("STATUS_INVALID_LDT_SIZE"), - SMB_NTSTATUS_INVALID_LDT_OFFSET => Some("STATUS_INVALID_LDT_OFFSET"), - SMB_NTSTATUS_INVALID_LDT_DESCRIPTOR => Some("STATUS_INVALID_LDT_DESCRIPTOR"), - SMB_NTSTATUS_INVALID_IMAGE_NE_FORMAT => Some("STATUS_INVALID_IMAGE_NE_FORMAT"), - SMB_NTSTATUS_RXACT_INVALID_STATE => Some("STATUS_RXACT_INVALID_STATE"), - SMB_NTSTATUS_RXACT_COMMIT_FAILURE => Some("STATUS_RXACT_COMMIT_FAILURE"), - SMB_NTSTATUS_MAPPED_FILE_SIZE_ZERO => Some("STATUS_MAPPED_FILE_SIZE_ZERO"), - SMB_NTSTATUS_TOO_MANY_OPENED_FILES => Some("STATUS_TOO_MANY_OPENED_FILES"), - SMB_NTSTATUS_CANCELLED => Some("STATUS_CANCELLED"), - SMB_NTSTATUS_CANNOT_DELETE => Some("STATUS_CANNOT_DELETE"), - SMB_NTSTATUS_INVALID_COMPUTER_NAME => Some("STATUS_INVALID_COMPUTER_NAME"), - SMB_NTSTATUS_FILE_DELETED => Some("STATUS_FILE_DELETED"), - SMB_NTSTATUS_SPECIAL_ACCOUNT => Some("STATUS_SPECIAL_ACCOUNT"), - SMB_NTSTATUS_SPECIAL_GROUP => Some("STATUS_SPECIAL_GROUP"), - SMB_NTSTATUS_SPECIAL_USER => Some("STATUS_SPECIAL_USER"), - SMB_NTSTATUS_MEMBERS_PRIMARY_GROUP => Some("STATUS_MEMBERS_PRIMARY_GROUP"), - SMB_NTSTATUS_FILE_CLOSED => Some("STATUS_FILE_CLOSED"), - SMB_NTSTATUS_TOO_MANY_THREADS => Some("STATUS_TOO_MANY_THREADS"), - SMB_NTSTATUS_THREAD_NOT_IN_PROCESS => Some("STATUS_THREAD_NOT_IN_PROCESS"), - SMB_NTSTATUS_TOKEN_ALREADY_IN_USE => Some("STATUS_TOKEN_ALREADY_IN_USE"), - SMB_NTSTATUS_PAGEFILE_QUOTA_EXCEEDED => Some("STATUS_PAGEFILE_QUOTA_EXCEEDED"), - SMB_NTSTATUS_COMMITMENT_LIMIT => Some("STATUS_COMMITMENT_LIMIT"), - SMB_NTSTATUS_INVALID_IMAGE_LE_FORMAT => Some("STATUS_INVALID_IMAGE_LE_FORMAT"), - SMB_NTSTATUS_INVALID_IMAGE_NOT_MZ => Some("STATUS_INVALID_IMAGE_NOT_MZ"), - SMB_NTSTATUS_INVALID_IMAGE_PROTECT => Some("STATUS_INVALID_IMAGE_PROTECT"), - SMB_NTSTATUS_INVALID_IMAGE_WIN_16 => Some("STATUS_INVALID_IMAGE_WIN_16"), - SMB_NTSTATUS_LOGON_SERVER_CONFLICT => Some("STATUS_LOGON_SERVER_CONFLICT"), - SMB_NTSTATUS_TIME_DIFFERENCE_AT_DC => Some("STATUS_TIME_DIFFERENCE_AT_DC"), - SMB_NTSTATUS_SYNCHRONIZATION_REQUIRED => Some("STATUS_SYNCHRONIZATION_REQUIRED"), - SMB_NTSTATUS_DLL_NOT_FOUND => Some("STATUS_DLL_NOT_FOUND"), - SMB_NTSTATUS_OPEN_FAILED => Some("STATUS_OPEN_FAILED"), - SMB_NTSTATUS_IO_PRIVILEGE_FAILED => Some("STATUS_IO_PRIVILEGE_FAILED"), - SMB_NTSTATUS_ORDINAL_NOT_FOUND => Some("STATUS_ORDINAL_NOT_FOUND"), - SMB_NTSTATUS_ENTRYPOINT_NOT_FOUND => Some("STATUS_ENTRYPOINT_NOT_FOUND"), - SMB_NTSTATUS_CONTROL_C_EXIT => Some("STATUS_CONTROL_C_EXIT"), - SMB_NTSTATUS_LOCAL_DISCONNECT => Some("STATUS_LOCAL_DISCONNECT"), - SMB_NTSTATUS_REMOTE_DISCONNECT => Some("STATUS_REMOTE_DISCONNECT"), - SMB_NTSTATUS_REMOTE_RESOURCES => Some("STATUS_REMOTE_RESOURCES"), - SMB_NTSTATUS_LINK_FAILED => Some("STATUS_LINK_FAILED"), - SMB_NTSTATUS_LINK_TIMEOUT => Some("STATUS_LINK_TIMEOUT"), - SMB_NTSTATUS_INVALID_CONNECTION => Some("STATUS_INVALID_CONNECTION"), - SMB_NTSTATUS_INVALID_ADDRESS => Some("STATUS_INVALID_ADDRESS"), - SMB_NTSTATUS_DLL_INIT_FAILED => Some("STATUS_DLL_INIT_FAILED"), - SMB_NTSTATUS_MISSING_SYSTEMFILE => Some("STATUS_MISSING_SYSTEMFILE"), - SMB_NTSTATUS_UNHANDLED_EXCEPTION => Some("STATUS_UNHANDLED_EXCEPTION"), - SMB_NTSTATUS_APP_INIT_FAILURE => Some("STATUS_APP_INIT_FAILURE"), - SMB_NTSTATUS_PAGEFILE_CREATE_FAILED => Some("STATUS_PAGEFILE_CREATE_FAILED"), - SMB_NTSTATUS_NO_PAGEFILE => Some("STATUS_NO_PAGEFILE"), - SMB_NTSTATUS_INVALID_LEVEL => Some("STATUS_INVALID_LEVEL"), - SMB_NTSTATUS_WRONG_PASSWORD_CORE => Some("STATUS_WRONG_PASSWORD_CORE"), - SMB_NTSTATUS_ILLEGAL_FLOAT_CONTEXT => Some("STATUS_ILLEGAL_FLOAT_CONTEXT"), - SMB_NTSTATUS_PIPE_BROKEN => Some("STATUS_PIPE_BROKEN"), - SMB_NTSTATUS_REGISTRY_CORRUPT => Some("STATUS_REGISTRY_CORRUPT"), - SMB_NTSTATUS_REGISTRY_IO_FAILED => Some("STATUS_REGISTRY_IO_FAILED"), - SMB_NTSTATUS_NO_EVENT_PAIR => Some("STATUS_NO_EVENT_PAIR"), - SMB_NTSTATUS_UNRECOGNIZED_VOLUME => Some("STATUS_UNRECOGNIZED_VOLUME"), - SMB_NTSTATUS_SERIAL_NO_DEVICE_INITED => Some("STATUS_SERIAL_NO_DEVICE_INITED"), - SMB_NTSTATUS_NO_SUCH_ALIAS => Some("STATUS_NO_SUCH_ALIAS"), - SMB_NTSTATUS_MEMBER_NOT_IN_ALIAS => Some("STATUS_MEMBER_NOT_IN_ALIAS"), - SMB_NTSTATUS_MEMBER_IN_ALIAS => Some("STATUS_MEMBER_IN_ALIAS"), - SMB_NTSTATUS_ALIAS_EXISTS => Some("STATUS_ALIAS_EXISTS"), - SMB_NTSTATUS_LOGON_NOT_GRANTED => Some("STATUS_LOGON_NOT_GRANTED"), - SMB_NTSTATUS_TOO_MANY_SECRETS => Some("STATUS_TOO_MANY_SECRETS"), - SMB_NTSTATUS_SECRET_TOO_LONG => Some("STATUS_SECRET_TOO_LONG"), - SMB_NTSTATUS_INTERNAL_DB_ERROR => Some("STATUS_INTERNAL_DB_ERROR"), - SMB_NTSTATUS_FULLSCREEN_MODE => Some("STATUS_FULLSCREEN_MODE"), - SMB_NTSTATUS_TOO_MANY_CONTEXT_IDS => Some("STATUS_TOO_MANY_CONTEXT_IDS"), - SMB_NTSTATUS_LOGON_TYPE_NOT_GRANTED => Some("STATUS_LOGON_TYPE_NOT_GRANTED"), - SMB_NTSTATUS_NOT_REGISTRY_FILE => Some("STATUS_NOT_REGISTRY_FILE"), - SMB_NTSTATUS_NT_CROSS_ENCRYPTION_REQUIRED => Some("STATUS_NT_CROSS_ENCRYPTION_REQUIRED"), - SMB_NTSTATUS_DOMAIN_CTRLR_CONFIG_ERROR => Some("STATUS_DOMAIN_CTRLR_CONFIG_ERROR"), - SMB_NTSTATUS_FT_MISSING_MEMBER => Some("STATUS_FT_MISSING_MEMBER"), - SMB_NTSTATUS_ILL_FORMED_SERVICE_ENTRY => Some("STATUS_ILL_FORMED_SERVICE_ENTRY"), - SMB_NTSTATUS_ILLEGAL_CHARACTER => Some("STATUS_ILLEGAL_CHARACTER"), - SMB_NTSTATUS_UNMAPPABLE_CHARACTER => Some("STATUS_UNMAPPABLE_CHARACTER"), - SMB_NTSTATUS_UNDEFINED_CHARACTER => Some("STATUS_UNDEFINED_CHARACTER"), - SMB_NTSTATUS_FLOPPY_VOLUME => Some("STATUS_FLOPPY_VOLUME"), - SMB_NTSTATUS_FLOPPY_ID_MARK_NOT_FOUND => Some("STATUS_FLOPPY_ID_MARK_NOT_FOUND"), - SMB_NTSTATUS_FLOPPY_WRONG_CYLINDER => Some("STATUS_FLOPPY_WRONG_CYLINDER"), - SMB_NTSTATUS_FLOPPY_UNKNOWN_ERROR => Some("STATUS_FLOPPY_UNKNOWN_ERROR"), - SMB_NTSTATUS_FLOPPY_BAD_REGISTERS => Some("STATUS_FLOPPY_BAD_REGISTERS"), - SMB_NTSTATUS_DISK_RECALIBRATE_FAILED => Some("STATUS_DISK_RECALIBRATE_FAILED"), - SMB_NTSTATUS_DISK_OPERATION_FAILED => Some("STATUS_DISK_OPERATION_FAILED"), - SMB_NTSTATUS_DISK_RESET_FAILED => Some("STATUS_DISK_RESET_FAILED"), - SMB_NTSTATUS_SHARED_IRQ_BUSY => Some("STATUS_SHARED_IRQ_BUSY"), - SMB_NTSTATUS_FT_ORPHANING => Some("STATUS_FT_ORPHANING"), - SMB_NTSTATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT => Some("STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT"), - SMB_NTSTATUS_PARTITION_FAILURE => Some("STATUS_PARTITION_FAILURE"), - SMB_NTSTATUS_INVALID_BLOCK_LENGTH => Some("STATUS_INVALID_BLOCK_LENGTH"), - SMB_NTSTATUS_DEVICE_NOT_PARTITIONED => Some("STATUS_DEVICE_NOT_PARTITIONED"), - SMB_NTSTATUS_UNABLE_TO_LOCK_MEDIA => Some("STATUS_UNABLE_TO_LOCK_MEDIA"), - SMB_NTSTATUS_UNABLE_TO_UNLOAD_MEDIA => Some("STATUS_UNABLE_TO_UNLOAD_MEDIA"), - SMB_NTSTATUS_EOM_OVERFLOW => Some("STATUS_EOM_OVERFLOW"), - SMB_NTSTATUS_NO_MEDIA => Some("STATUS_NO_MEDIA"), - SMB_NTSTATUS_NO_SUCH_MEMBER => Some("STATUS_NO_SUCH_MEMBER"), - SMB_NTSTATUS_INVALID_MEMBER => Some("STATUS_INVALID_MEMBER"), - SMB_NTSTATUS_KEY_DELETED => Some("STATUS_KEY_DELETED"), - SMB_NTSTATUS_NO_LOG_SPACE => Some("STATUS_NO_LOG_SPACE"), - SMB_NTSTATUS_TOO_MANY_SIDS => Some("STATUS_TOO_MANY_SIDS"), - SMB_NTSTATUS_LM_CROSS_ENCRYPTION_REQUIRED => Some("STATUS_LM_CROSS_ENCRYPTION_REQUIRED"), - SMB_NTSTATUS_KEY_HAS_CHILDREN => Some("STATUS_KEY_HAS_CHILDREN"), - SMB_NTSTATUS_CHILD_MUST_BE_VOLATILE => Some("STATUS_CHILD_MUST_BE_VOLATILE"), - SMB_NTSTATUS_DEVICE_CONFIGURATION_ERROR => Some("STATUS_DEVICE_CONFIGURATION_ERROR"), - SMB_NTSTATUS_DRIVER_INTERNAL_ERROR => Some("STATUS_DRIVER_INTERNAL_ERROR"), - SMB_NTSTATUS_INVALID_DEVICE_STATE => Some("STATUS_INVALID_DEVICE_STATE"), - SMB_NTSTATUS_IO_DEVICE_ERROR => Some("STATUS_IO_DEVICE_ERROR"), - SMB_NTSTATUS_DEVICE_PROTOCOL_ERROR => Some("STATUS_DEVICE_PROTOCOL_ERROR"), - SMB_NTSTATUS_BACKUP_CONTROLLER => Some("STATUS_BACKUP_CONTROLLER"), - SMB_NTSTATUS_LOG_FILE_FULL => Some("STATUS_LOG_FILE_FULL"), - SMB_NTSTATUS_TOO_LATE => Some("STATUS_TOO_LATE"), - SMB_NTSTATUS_NO_TRUST_LSA_SECRET => Some("STATUS_NO_TRUST_LSA_SECRET"), - SMB_NTSTATUS_NO_TRUST_SAM_ACCOUNT => Some("STATUS_NO_TRUST_SAM_ACCOUNT"), - SMB_NTSTATUS_TRUSTED_DOMAIN_FAILURE => Some("STATUS_TRUSTED_DOMAIN_FAILURE"), - SMB_NTSTATUS_TRUSTED_RELATIONSHIP_FAILURE => Some("STATUS_TRUSTED_RELATIONSHIP_FAILURE"), - SMB_NTSTATUS_EVENTLOG_FILE_CORRUPT => Some("STATUS_EVENTLOG_FILE_CORRUPT"), - SMB_NTSTATUS_EVENTLOG_CANT_START => Some("STATUS_EVENTLOG_CANT_START"), - SMB_NTSTATUS_TRUST_FAILURE => Some("STATUS_TRUST_FAILURE"), - SMB_NTSTATUS_MUTANT_LIMIT_EXCEEDED => Some("STATUS_MUTANT_LIMIT_EXCEEDED"), - SMB_NTSTATUS_NETLOGON_NOT_STARTED => Some("STATUS_NETLOGON_NOT_STARTED"), - SMB_NTSTATUS_ACCOUNT_EXPIRED => Some("STATUS_ACCOUNT_EXPIRED"), - SMB_NTSTATUS_POSSIBLE_DEADLOCK => Some("STATUS_POSSIBLE_DEADLOCK"), - SMB_NTSTATUS_NETWORK_CREDENTIAL_CONFLICT => Some("STATUS_NETWORK_CREDENTIAL_CONFLICT"), - SMB_NTSTATUS_REMOTE_SESSION_LIMIT => Some("STATUS_REMOTE_SESSION_LIMIT"), - SMB_NTSTATUS_EVENTLOG_FILE_CHANGED => Some("STATUS_EVENTLOG_FILE_CHANGED"), - SMB_NTSTATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT => Some("STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT"), - SMB_NTSTATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT => Some("STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT"), - SMB_NTSTATUS_NOLOGON_SERVER_TRUST_ACCOUNT => Some("STATUS_NOLOGON_SERVER_TRUST_ACCOUNT"), - SMB_NTSTATUS_DOMAIN_TRUST_INCONSISTENT => Some("STATUS_DOMAIN_TRUST_INCONSISTENT"), - SMB_NTSTATUS_FS_DRIVER_REQUIRED => Some("STATUS_FS_DRIVER_REQUIRED"), - SMB_NTSTATUS_IMAGE_ALREADY_LOADED_AS_DLL => Some("STATUS_IMAGE_ALREADY_LOADED_AS_DLL"), - SMB_NTSTATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING => Some("STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING"), - SMB_NTSTATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME => Some("STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME"), - SMB_NTSTATUS_SECURITY_STREAM_IS_INCONSISTENT => Some("STATUS_SECURITY_STREAM_IS_INCONSISTENT"), - SMB_NTSTATUS_INVALID_LOCK_RANGE => Some("STATUS_INVALID_LOCK_RANGE"), - SMB_NTSTATUS_INVALID_ACE_CONDITION => Some("STATUS_INVALID_ACE_CONDITION"), - SMB_NTSTATUS_IMAGE_SUBSYSTEM_NOT_PRESENT => Some("STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT"), - SMB_NTSTATUS_NOTIFICATION_GUID_ALREADY_DEFINED => Some("STATUS_NOTIFICATION_GUID_ALREADY_DEFINED"), - SMB_NTSTATUS_NETWORK_OPEN_RESTRICTION => Some("STATUS_NETWORK_OPEN_RESTRICTION"), - SMB_NTSTATUS_NO_USER_SESSION_KEY => Some("STATUS_NO_USER_SESSION_KEY"), - SMB_NTSTATUS_USER_SESSION_DELETED => Some("STATUS_USER_SESSION_DELETED"), - SMB_NTSTATUS_RESOURCE_LANG_NOT_FOUND => Some("STATUS_RESOURCE_LANG_NOT_FOUND"), - SMB_NTSTATUS_INSUFF_SERVER_RESOURCES => Some("STATUS_INSUFF_SERVER_RESOURCES"), - SMB_NTSTATUS_INVALID_BUFFER_SIZE => Some("STATUS_INVALID_BUFFER_SIZE"), - SMB_NTSTATUS_INVALID_ADDRESS_COMPONENT => Some("STATUS_INVALID_ADDRESS_COMPONENT"), - SMB_NTSTATUS_INVALID_ADDRESS_WILDCARD => Some("STATUS_INVALID_ADDRESS_WILDCARD"), - SMB_NTSTATUS_TOO_MANY_ADDRESSES => Some("STATUS_TOO_MANY_ADDRESSES"), - SMB_NTSTATUS_ADDRESS_ALREADY_EXISTS => Some("STATUS_ADDRESS_ALREADY_EXISTS"), - SMB_NTSTATUS_ADDRESS_CLOSED => Some("STATUS_ADDRESS_CLOSED"), - SMB_NTSTATUS_CONNECTION_DISCONNECTED => Some("STATUS_CONNECTION_DISCONNECTED"), - SMB_NTSTATUS_CONNECTION_RESET => Some("STATUS_CONNECTION_RESET"), - SMB_NTSTATUS_TOO_MANY_NODES => Some("STATUS_TOO_MANY_NODES"), - SMB_NTSTATUS_TRANSACTION_ABORTED => Some("STATUS_TRANSACTION_ABORTED"), - SMB_NTSTATUS_TRANSACTION_TIMED_OUT => Some("STATUS_TRANSACTION_TIMED_OUT"), - SMB_NTSTATUS_TRANSACTION_NO_RELEASE => Some("STATUS_TRANSACTION_NO_RELEASE"), - SMB_NTSTATUS_TRANSACTION_NO_MATCH => Some("STATUS_TRANSACTION_NO_MATCH"), - SMB_NTSTATUS_TRANSACTION_RESPONDED => Some("STATUS_TRANSACTION_RESPONDED"), - SMB_NTSTATUS_TRANSACTION_INVALID_ID => Some("STATUS_TRANSACTION_INVALID_ID"), - SMB_NTSTATUS_TRANSACTION_INVALID_TYPE => Some("STATUS_TRANSACTION_INVALID_TYPE"), - SMB_NTSTATUS_NOT_SERVER_SESSION => Some("STATUS_NOT_SERVER_SESSION"), - SMB_NTSTATUS_NOT_CLIENT_SESSION => Some("STATUS_NOT_CLIENT_SESSION"), - SMB_NTSTATUS_CANNOT_LOAD_REGISTRY_FILE => Some("STATUS_CANNOT_LOAD_REGISTRY_FILE"), - SMB_NTSTATUS_DEBUG_ATTACH_FAILED => Some("STATUS_DEBUG_ATTACH_FAILED"), - SMB_NTSTATUS_SYSTEM_PROCESS_TERMINATED => Some("STATUS_SYSTEM_PROCESS_TERMINATED"), - SMB_NTSTATUS_DATA_NOT_ACCEPTED => Some("STATUS_DATA_NOT_ACCEPTED"), - SMB_NTSTATUS_NO_BROWSER_SERVERS_FOUND => Some("STATUS_NO_BROWSER_SERVERS_FOUND"), - SMB_NTSTATUS_VDM_HARD_ERROR => Some("STATUS_VDM_HARD_ERROR"), - SMB_NTSTATUS_DRIVER_CANCEL_TIMEOUT => Some("STATUS_DRIVER_CANCEL_TIMEOUT"), - SMB_NTSTATUS_REPLY_MESSAGE_MISMATCH => Some("STATUS_REPLY_MESSAGE_MISMATCH"), - SMB_NTSTATUS_MAPPED_ALIGNMENT => Some("STATUS_MAPPED_ALIGNMENT"), - SMB_NTSTATUS_IMAGE_CHECKSUM_MISMATCH => Some("STATUS_IMAGE_CHECKSUM_MISMATCH"), - SMB_NTSTATUS_LOST_WRITEBEHIND_DATA => Some("STATUS_LOST_WRITEBEHIND_DATA"), - SMB_NTSTATUS_CLIENT_SERVER_PARAMETERS_INVALID => Some("STATUS_CLIENT_SERVER_PARAMETERS_INVALID"), - SMB_NTSTATUS_PASSWORD_MUST_CHANGE => Some("STATUS_PASSWORD_MUST_CHANGE"), - SMB_NTSTATUS_NOT_FOUND => Some("STATUS_NOT_FOUND"), - SMB_NTSTATUS_NOT_TINY_STREAM => Some("STATUS_NOT_TINY_STREAM"), - SMB_NTSTATUS_RECOVERY_FAILURE => Some("STATUS_RECOVERY_FAILURE"), - SMB_NTSTATUS_STACK_OVERFLOW_READ => Some("STATUS_STACK_OVERFLOW_READ"), - SMB_NTSTATUS_FAIL_CHECK => Some("STATUS_FAIL_CHECK"), - SMB_NTSTATUS_DUPLICATE_OBJECTID => Some("STATUS_DUPLICATE_OBJECTID"), - SMB_NTSTATUS_OBJECTID_EXISTS => Some("STATUS_OBJECTID_EXISTS"), - SMB_NTSTATUS_CONVERT_TO_LARGE => Some("STATUS_CONVERT_TO_LARGE"), - SMB_NTSTATUS_RETRY => Some("STATUS_RETRY"), - SMB_NTSTATUS_FOUND_OUT_OF_SCOPE => Some("STATUS_FOUND_OUT_OF_SCOPE"), - SMB_NTSTATUS_ALLOCATE_BUCKET => Some("STATUS_ALLOCATE_BUCKET"), - SMB_NTSTATUS_PROPSET_NOT_FOUND => Some("STATUS_PROPSET_NOT_FOUND"), - SMB_NTSTATUS_MARSHALL_OVERFLOW => Some("STATUS_MARSHALL_OVERFLOW"), - SMB_NTSTATUS_INVALID_VARIANT => Some("STATUS_INVALID_VARIANT"), - SMB_NTSTATUS_DOMAIN_CONTROLLER_NOT_FOUND => Some("STATUS_DOMAIN_CONTROLLER_NOT_FOUND"), - SMB_NTSTATUS_ACCOUNT_LOCKED_OUT => Some("STATUS_ACCOUNT_LOCKED_OUT"), - SMB_NTSTATUS_HANDLE_NOT_CLOSABLE => Some("STATUS_HANDLE_NOT_CLOSABLE"), - SMB_NTSTATUS_CONNECTION_REFUSED => Some("STATUS_CONNECTION_REFUSED"), - SMB_NTSTATUS_GRACEFUL_DISCONNECT => Some("STATUS_GRACEFUL_DISCONNECT"), - SMB_NTSTATUS_ADDRESS_ALREADY_ASSOCIATED => Some("STATUS_ADDRESS_ALREADY_ASSOCIATED"), - SMB_NTSTATUS_ADDRESS_NOT_ASSOCIATED => Some("STATUS_ADDRESS_NOT_ASSOCIATED"), - SMB_NTSTATUS_CONNECTION_INVALID => Some("STATUS_CONNECTION_INVALID"), - SMB_NTSTATUS_CONNECTION_ACTIVE => Some("STATUS_CONNECTION_ACTIVE"), - SMB_NTSTATUS_NETWORK_UNREACHABLE => Some("STATUS_NETWORK_UNREACHABLE"), - SMB_NTSTATUS_HOST_UNREACHABLE => Some("STATUS_HOST_UNREACHABLE"), - SMB_NTSTATUS_PROTOCOL_UNREACHABLE => Some("STATUS_PROTOCOL_UNREACHABLE"), - SMB_NTSTATUS_PORT_UNREACHABLE => Some("STATUS_PORT_UNREACHABLE"), - SMB_NTSTATUS_REQUEST_ABORTED => Some("STATUS_REQUEST_ABORTED"), - SMB_NTSTATUS_CONNECTION_ABORTED => Some("STATUS_CONNECTION_ABORTED"), - SMB_NTSTATUS_BAD_COMPRESSION_BUFFER => Some("STATUS_BAD_COMPRESSION_BUFFER"), - SMB_NTSTATUS_USER_MAPPED_FILE => Some("STATUS_USER_MAPPED_FILE"), - SMB_NTSTATUS_AUDIT_FAILED => Some("STATUS_AUDIT_FAILED"), - SMB_NTSTATUS_TIMER_RESOLUTION_NOT_SET => Some("STATUS_TIMER_RESOLUTION_NOT_SET"), - SMB_NTSTATUS_CONNECTION_COUNT_LIMIT => Some("STATUS_CONNECTION_COUNT_LIMIT"), - SMB_NTSTATUS_LOGIN_TIME_RESTRICTION => Some("STATUS_LOGIN_TIME_RESTRICTION"), - SMB_NTSTATUS_LOGIN_WKSTA_RESTRICTION => Some("STATUS_LOGIN_WKSTA_RESTRICTION"), - SMB_NTSTATUS_IMAGE_MP_UP_MISMATCH => Some("STATUS_IMAGE_MP_UP_MISMATCH"), - SMB_NTSTATUS_INSUFFICIENT_LOGON_INFO => Some("STATUS_INSUFFICIENT_LOGON_INFO"), - SMB_NTSTATUS_BAD_DLL_ENTRYPOINT => Some("STATUS_BAD_DLL_ENTRYPOINT"), - SMB_NTSTATUS_BAD_SERVICE_ENTRYPOINT => Some("STATUS_BAD_SERVICE_ENTRYPOINT"), - SMB_NTSTATUS_LPC_REPLY_LOST => Some("STATUS_LPC_REPLY_LOST"), - SMB_NTSTATUS_IP_ADDRESS_CONFLICT1 => Some("STATUS_IP_ADDRESS_CONFLICT1"), - SMB_NTSTATUS_IP_ADDRESS_CONFLICT2 => Some("STATUS_IP_ADDRESS_CONFLICT2"), - SMB_NTSTATUS_REGISTRY_QUOTA_LIMIT => Some("STATUS_REGISTRY_QUOTA_LIMIT"), - SMB_NTSTATUS_PATH_NOT_COVERED => Some("STATUS_PATH_NOT_COVERED"), - SMB_NTSTATUS_NO_CALLBACK_ACTIVE => Some("STATUS_NO_CALLBACK_ACTIVE"), - SMB_NTSTATUS_LICENSE_QUOTA_EXCEEDED => Some("STATUS_LICENSE_QUOTA_EXCEEDED"), - SMB_NTSTATUS_PWD_TOO_SHORT => Some("STATUS_PWD_TOO_SHORT"), - SMB_NTSTATUS_PWD_TOO_RECENT => Some("STATUS_PWD_TOO_RECENT"), - SMB_NTSTATUS_PWD_HISTORY_CONFLICT => Some("STATUS_PWD_HISTORY_CONFLICT"), - SMB_NTSTATUS_PLUGPLAY_NO_DEVICE => Some("STATUS_PLUGPLAY_NO_DEVICE"), - SMB_NTSTATUS_UNSUPPORTED_COMPRESSION => Some("STATUS_UNSUPPORTED_COMPRESSION"), - SMB_NTSTATUS_INVALID_HW_PROFILE => Some("STATUS_INVALID_HW_PROFILE"), - SMB_NTSTATUS_INVALID_PLUGPLAY_DEVICE_PATH => Some("STATUS_INVALID_PLUGPLAY_DEVICE_PATH"), - SMB_NTSTATUS_DRIVER_ORDINAL_NOT_FOUND => Some("STATUS_DRIVER_ORDINAL_NOT_FOUND"), - SMB_NTSTATUS_DRIVER_ENTRYPOINT_NOT_FOUND => Some("STATUS_DRIVER_ENTRYPOINT_NOT_FOUND"), - SMB_NTSTATUS_RESOURCE_NOT_OWNED => Some("STATUS_RESOURCE_NOT_OWNED"), - SMB_NTSTATUS_TOO_MANY_LINKS => Some("STATUS_TOO_MANY_LINKS"), - SMB_NTSTATUS_QUOTA_LIST_INCONSISTENT => Some("STATUS_QUOTA_LIST_INCONSISTENT"), - SMB_NTSTATUS_FILE_IS_OFFLINE => Some("STATUS_FILE_IS_OFFLINE"), - SMB_NTSTATUS_EVALUATION_EXPIRATION => Some("STATUS_EVALUATION_EXPIRATION"), - SMB_NTSTATUS_ILLEGAL_DLL_RELOCATION => Some("STATUS_ILLEGAL_DLL_RELOCATION"), - SMB_NTSTATUS_LICENSE_VIOLATION => Some("STATUS_LICENSE_VIOLATION"), - SMB_NTSTATUS_DLL_INIT_FAILED_LOGOFF => Some("STATUS_DLL_INIT_FAILED_LOGOFF"), - SMB_NTSTATUS_DRIVER_UNABLE_TO_LOAD => Some("STATUS_DRIVER_UNABLE_TO_LOAD"), - SMB_NTSTATUS_DFS_UNAVAILABLE => Some("STATUS_DFS_UNAVAILABLE"), - SMB_NTSTATUS_VOLUME_DISMOUNTED => Some("STATUS_VOLUME_DISMOUNTED"), - SMB_NTSTATUS_WX86_INTERNAL_ERROR => Some("STATUS_WX86_INTERNAL_ERROR"), - SMB_NTSTATUS_WX86_FLOAT_STACK_CHECK => Some("STATUS_WX86_FLOAT_STACK_CHECK"), - SMB_NTSTATUS_VALIDATE_CONTINUE => Some("STATUS_VALIDATE_CONTINUE"), - SMB_NTSTATUS_NO_MATCH => Some("STATUS_NO_MATCH"), - SMB_NTSTATUS_NO_MORE_MATCHES => Some("STATUS_NO_MORE_MATCHES"), - SMB_NTSTATUS_NOT_A_REPARSE_POINT => Some("STATUS_NOT_A_REPARSE_POINT"), - SMB_NTSTATUS_IO_REPARSE_TAG_INVALID => Some("STATUS_IO_REPARSE_TAG_INVALID"), - SMB_NTSTATUS_IO_REPARSE_TAG_MISMATCH => Some("STATUS_IO_REPARSE_TAG_MISMATCH"), - SMB_NTSTATUS_IO_REPARSE_DATA_INVALID => Some("STATUS_IO_REPARSE_DATA_INVALID"), - SMB_NTSTATUS_IO_REPARSE_TAG_NOT_HANDLED => Some("STATUS_IO_REPARSE_TAG_NOT_HANDLED"), - SMB_NTSTATUS_REPARSE_POINT_NOT_RESOLVED => Some("STATUS_REPARSE_POINT_NOT_RESOLVED"), - SMB_NTSTATUS_DIRECTORY_IS_A_REPARSE_POINT => Some("STATUS_DIRECTORY_IS_A_REPARSE_POINT"), - SMB_NTSTATUS_RANGE_LIST_CONFLICT => Some("STATUS_RANGE_LIST_CONFLICT"), - SMB_NTSTATUS_SOURCE_ELEMENT_EMPTY => Some("STATUS_SOURCE_ELEMENT_EMPTY"), - SMB_NTSTATUS_DESTINATION_ELEMENT_FULL => Some("STATUS_DESTINATION_ELEMENT_FULL"), - SMB_NTSTATUS_ILLEGAL_ELEMENT_ADDRESS => Some("STATUS_ILLEGAL_ELEMENT_ADDRESS"), - SMB_NTSTATUS_MAGAZINE_NOT_PRESENT => Some("STATUS_MAGAZINE_NOT_PRESENT"), - SMB_NTSTATUS_REINITIALIZATION_NEEDED => Some("STATUS_REINITIALIZATION_NEEDED"), - SMB_NTSTATUS_ENCRYPTION_FAILED => Some("STATUS_ENCRYPTION_FAILED"), - SMB_NTSTATUS_DECRYPTION_FAILED => Some("STATUS_DECRYPTION_FAILED"), - SMB_NTSTATUS_RANGE_NOT_FOUND => Some("STATUS_RANGE_NOT_FOUND"), - SMB_NTSTATUS_NO_RECOVERY_POLICY => Some("STATUS_NO_RECOVERY_POLICY"), - SMB_NTSTATUS_NO_EFS => Some("STATUS_NO_EFS"), - SMB_NTSTATUS_WRONG_EFS => Some("STATUS_WRONG_EFS"), - SMB_NTSTATUS_NO_USER_KEYS => Some("STATUS_NO_USER_KEYS"), - SMB_NTSTATUS_FILE_NOT_ENCRYPTED => Some("STATUS_FILE_NOT_ENCRYPTED"), - SMB_NTSTATUS_NOT_EXPORT_FORMAT => Some("STATUS_NOT_EXPORT_FORMAT"), - SMB_NTSTATUS_FILE_ENCRYPTED => Some("STATUS_FILE_ENCRYPTED"), - SMB_NTSTATUS_WMI_GUID_NOT_FOUND => Some("STATUS_WMI_GUID_NOT_FOUND"), - SMB_NTSTATUS_WMI_INSTANCE_NOT_FOUND => Some("STATUS_WMI_INSTANCE_NOT_FOUND"), - SMB_NTSTATUS_WMI_ITEMID_NOT_FOUND => Some("STATUS_WMI_ITEMID_NOT_FOUND"), - SMB_NTSTATUS_WMI_TRY_AGAIN => Some("STATUS_WMI_TRY_AGAIN"), - SMB_NTSTATUS_SHARED_POLICY => Some("STATUS_SHARED_POLICY"), - SMB_NTSTATUS_POLICY_OBJECT_NOT_FOUND => Some("STATUS_POLICY_OBJECT_NOT_FOUND"), - SMB_NTSTATUS_POLICY_ONLY_IN_DS => Some("STATUS_POLICY_ONLY_IN_DS"), - SMB_NTSTATUS_VOLUME_NOT_UPGRADED => Some("STATUS_VOLUME_NOT_UPGRADED"), - SMB_NTSTATUS_REMOTE_STORAGE_NOT_ACTIVE => Some("STATUS_REMOTE_STORAGE_NOT_ACTIVE"), - SMB_NTSTATUS_REMOTE_STORAGE_MEDIA_ERROR => Some("STATUS_REMOTE_STORAGE_MEDIA_ERROR"), - SMB_NTSTATUS_NO_TRACKING_SERVICE => Some("STATUS_NO_TRACKING_SERVICE"), - SMB_NTSTATUS_SERVER_SID_MISMATCH => Some("STATUS_SERVER_SID_MISMATCH"), - SMB_NTSTATUS_DS_NO_ATTRIBUTE_OR_VALUE => Some("STATUS_DS_NO_ATTRIBUTE_OR_VALUE"), - SMB_NTSTATUS_DS_INVALID_ATTRIBUTE_SYNTAX => Some("STATUS_DS_INVALID_ATTRIBUTE_SYNTAX"), - SMB_NTSTATUS_DS_ATTRIBUTE_TYPE_UNDEFINED => Some("STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED"), - SMB_NTSTATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS => Some("STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS"), - SMB_NTSTATUS_DS_BUSY => Some("STATUS_DS_BUSY"), - SMB_NTSTATUS_DS_UNAVAILABLE => Some("STATUS_DS_UNAVAILABLE"), - SMB_NTSTATUS_DS_NO_RIDS_ALLOCATED => Some("STATUS_DS_NO_RIDS_ALLOCATED"), - SMB_NTSTATUS_DS_NO_MORE_RIDS => Some("STATUS_DS_NO_MORE_RIDS"), - SMB_NTSTATUS_DS_INCORRECT_ROLE_OWNER => Some("STATUS_DS_INCORRECT_ROLE_OWNER"), - SMB_NTSTATUS_DS_RIDMGR_INIT_ERROR => Some("STATUS_DS_RIDMGR_INIT_ERROR"), - SMB_NTSTATUS_DS_OBJ_CLASS_VIOLATION => Some("STATUS_DS_OBJ_CLASS_VIOLATION"), - SMB_NTSTATUS_DS_CANT_ON_NON_LEAF => Some("STATUS_DS_CANT_ON_NON_LEAF"), - SMB_NTSTATUS_DS_CANT_ON_RDN => Some("STATUS_DS_CANT_ON_RDN"), - SMB_NTSTATUS_DS_CANT_MOD_OBJ_CLASS => Some("STATUS_DS_CANT_MOD_OBJ_CLASS"), - SMB_NTSTATUS_DS_CROSS_DOM_MOVE_FAILED => Some("STATUS_DS_CROSS_DOM_MOVE_FAILED"), - SMB_NTSTATUS_DS_GC_NOT_AVAILABLE => Some("STATUS_DS_GC_NOT_AVAILABLE"), - SMB_NTSTATUS_DIRECTORY_SERVICE_REQUIRED => Some("STATUS_DIRECTORY_SERVICE_REQUIRED"), - SMB_NTSTATUS_REPARSE_ATTRIBUTE_CONFLICT => Some("STATUS_REPARSE_ATTRIBUTE_CONFLICT"), - SMB_NTSTATUS_CANT_ENABLE_DENY_ONLY => Some("STATUS_CANT_ENABLE_DENY_ONLY"), - SMB_NTSTATUS_FLOAT_MULTIPLE_FAULTS => Some("STATUS_FLOAT_MULTIPLE_FAULTS"), - SMB_NTSTATUS_FLOAT_MULTIPLE_TRAPS => Some("STATUS_FLOAT_MULTIPLE_TRAPS"), - SMB_NTSTATUS_DEVICE_REMOVED => Some("STATUS_DEVICE_REMOVED"), - SMB_NTSTATUS_JOURNAL_DELETE_IN_PROGRESS => Some("STATUS_JOURNAL_DELETE_IN_PROGRESS"), - SMB_NTSTATUS_JOURNAL_NOT_ACTIVE => Some("STATUS_JOURNAL_NOT_ACTIVE"), - SMB_NTSTATUS_NOINTERFACE => Some("STATUS_NOINTERFACE"), - SMB_NTSTATUS_DS_ADMIN_LIMIT_EXCEEDED => Some("STATUS_DS_ADMIN_LIMIT_EXCEEDED"), - SMB_NTSTATUS_DRIVER_FAILED_SLEEP => Some("STATUS_DRIVER_FAILED_SLEEP"), - SMB_NTSTATUS_MUTUAL_AUTHENTICATION_FAILED => Some("STATUS_MUTUAL_AUTHENTICATION_FAILED"), - SMB_NTSTATUS_CORRUPT_SYSTEM_FILE => Some("STATUS_CORRUPT_SYSTEM_FILE"), - SMB_NTSTATUS_DATATYPE_MISALIGNMENT_ERROR => Some("STATUS_DATATYPE_MISALIGNMENT_ERROR"), - SMB_NTSTATUS_WMI_READ_ONLY => Some("STATUS_WMI_READ_ONLY"), - SMB_NTSTATUS_WMI_SET_FAILURE => Some("STATUS_WMI_SET_FAILURE"), - SMB_NTSTATUS_COMMITMENT_MINIMUM => Some("STATUS_COMMITMENT_MINIMUM"), - SMB_NTSTATUS_REG_NAT_CONSUMPTION => Some("STATUS_REG_NAT_CONSUMPTION"), - SMB_NTSTATUS_TRANSPORT_FULL => Some("STATUS_TRANSPORT_FULL"), - SMB_NTSTATUS_DS_SAM_INIT_FAILURE => Some("STATUS_DS_SAM_INIT_FAILURE"), - SMB_NTSTATUS_ONLY_IF_CONNECTED => Some("STATUS_ONLY_IF_CONNECTED"), - SMB_NTSTATUS_DS_SENSITIVE_GROUP_VIOLATION => Some("STATUS_DS_SENSITIVE_GROUP_VIOLATION"), - SMB_NTSTATUS_PNP_RESTART_ENUMERATION => Some("STATUS_PNP_RESTART_ENUMERATION"), - SMB_NTSTATUS_JOURNAL_ENTRY_DELETED => Some("STATUS_JOURNAL_ENTRY_DELETED"), - SMB_NTSTATUS_DS_CANT_MOD_PRIMARYGROUPID => Some("STATUS_DS_CANT_MOD_PRIMARYGROUPID"), - SMB_NTSTATUS_SYSTEM_IMAGE_BAD_SIGNATURE => Some("STATUS_SYSTEM_IMAGE_BAD_SIGNATURE"), - SMB_NTSTATUS_PNP_REBOOT_REQUIRED => Some("STATUS_PNP_REBOOT_REQUIRED"), - SMB_NTSTATUS_POWER_STATE_INVALID => Some("STATUS_POWER_STATE_INVALID"), - SMB_NTSTATUS_DS_INVALID_GROUP_TYPE => Some("STATUS_DS_INVALID_GROUP_TYPE"), - SMB_NTSTATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN => Some("STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN"), - SMB_NTSTATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN => Some("STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN"), - SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER => Some("STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER"), - SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER => Some("STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER"), - SMB_NTSTATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER => Some("STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER"), - SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER => Some("STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER"), - SMB_NTSTATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER => Some("STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER"), - SMB_NTSTATUS_DS_HAVE_PRIMARY_MEMBERS => Some("STATUS_DS_HAVE_PRIMARY_MEMBERS"), - SMB_NTSTATUS_WMI_NOT_SUPPORTED => Some("STATUS_WMI_NOT_SUPPORTED"), - SMB_NTSTATUS_INSUFFICIENT_POWER => Some("STATUS_INSUFFICIENT_POWER"), - SMB_NTSTATUS_SAM_NEED_BOOTKEY_PASSWORD => Some("STATUS_SAM_NEED_BOOTKEY_PASSWORD"), - SMB_NTSTATUS_SAM_NEED_BOOTKEY_FLOPPY => Some("STATUS_SAM_NEED_BOOTKEY_FLOPPY"), - SMB_NTSTATUS_DS_CANT_START => Some("STATUS_DS_CANT_START"), - SMB_NTSTATUS_DS_INIT_FAILURE => Some("STATUS_DS_INIT_FAILURE"), - SMB_NTSTATUS_SAM_INIT_FAILURE => Some("STATUS_SAM_INIT_FAILURE"), - SMB_NTSTATUS_DS_GC_REQUIRED => Some("STATUS_DS_GC_REQUIRED"), - SMB_NTSTATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY => Some("STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY"), - SMB_NTSTATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS => Some("STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS"), - SMB_NTSTATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED => Some("STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED"), - SMB_NTSTATUS_CURRENT_DOMAIN_NOT_ALLOWED => Some("STATUS_CURRENT_DOMAIN_NOT_ALLOWED"), - SMB_NTSTATUS_CANNOT_MAKE => Some("STATUS_CANNOT_MAKE"), - SMB_NTSTATUS_SYSTEM_SHUTDOWN => Some("STATUS_SYSTEM_SHUTDOWN"), - SMB_NTSTATUS_DS_INIT_FAILURE_CONSOLE => Some("STATUS_DS_INIT_FAILURE_CONSOLE"), - SMB_NTSTATUS_DS_SAM_INIT_FAILURE_CONSOLE => Some("STATUS_DS_SAM_INIT_FAILURE_CONSOLE"), - SMB_NTSTATUS_UNFINISHED_CONTEXT_DELETED => Some("STATUS_UNFINISHED_CONTEXT_DELETED"), - SMB_NTSTATUS_NO_TGT_REPLY => Some("STATUS_NO_TGT_REPLY"), - SMB_NTSTATUS_OBJECTID_NOT_FOUND => Some("STATUS_OBJECTID_NOT_FOUND"), - SMB_NTSTATUS_NO_IP_ADDRESSES => Some("STATUS_NO_IP_ADDRESSES"), - SMB_NTSTATUS_WRONG_CREDENTIAL_HANDLE => Some("STATUS_WRONG_CREDENTIAL_HANDLE"), - SMB_NTSTATUS_CRYPTO_SYSTEM_INVALID => Some("STATUS_CRYPTO_SYSTEM_INVALID"), - SMB_NTSTATUS_MAX_REFERRALS_EXCEEDED => Some("STATUS_MAX_REFERRALS_EXCEEDED"), - SMB_NTSTATUS_MUST_BE_KDC => Some("STATUS_MUST_BE_KDC"), - SMB_NTSTATUS_STRONG_CRYPTO_NOT_SUPPORTED => Some("STATUS_STRONG_CRYPTO_NOT_SUPPORTED"), - SMB_NTSTATUS_TOO_MANY_PRINCIPALS => Some("STATUS_TOO_MANY_PRINCIPALS"), - SMB_NTSTATUS_NO_PA_DATA => Some("STATUS_NO_PA_DATA"), - SMB_NTSTATUS_PKINIT_NAME_MISMATCH => Some("STATUS_PKINIT_NAME_MISMATCH"), - SMB_NTSTATUS_SMARTCARD_LOGON_REQUIRED => Some("STATUS_SMARTCARD_LOGON_REQUIRED"), - SMB_NTSTATUS_KDC_INVALID_REQUEST => Some("STATUS_KDC_INVALID_REQUEST"), - SMB_NTSTATUS_KDC_UNABLE_TO_REFER => Some("STATUS_KDC_UNABLE_TO_REFER"), - SMB_NTSTATUS_KDC_UNKNOWN_ETYPE => Some("STATUS_KDC_UNKNOWN_ETYPE"), - SMB_NTSTATUS_SHUTDOWN_IN_PROGRESS => Some("STATUS_SHUTDOWN_IN_PROGRESS"), - SMB_NTSTATUS_SERVER_SHUTDOWN_IN_PROGRESS => Some("STATUS_SERVER_SHUTDOWN_IN_PROGRESS"), - SMB_NTSTATUS_NOT_SUPPORTED_ON_SBS => Some("STATUS_NOT_SUPPORTED_ON_SBS"), - SMB_NTSTATUS_WMI_GUID_DISCONNECTED => Some("STATUS_WMI_GUID_DISCONNECTED"), - SMB_NTSTATUS_WMI_ALREADY_DISABLED => Some("STATUS_WMI_ALREADY_DISABLED"), - SMB_NTSTATUS_WMI_ALREADY_ENABLED => Some("STATUS_WMI_ALREADY_ENABLED"), - SMB_NTSTATUS_MFT_TOO_FRAGMENTED => Some("STATUS_MFT_TOO_FRAGMENTED"), - SMB_NTSTATUS_COPY_PROTECTION_FAILURE => Some("STATUS_COPY_PROTECTION_FAILURE"), - SMB_NTSTATUS_CSS_AUTHENTICATION_FAILURE => Some("STATUS_CSS_AUTHENTICATION_FAILURE"), - SMB_NTSTATUS_CSS_KEY_NOT_PRESENT => Some("STATUS_CSS_KEY_NOT_PRESENT"), - SMB_NTSTATUS_CSS_KEY_NOT_ESTABLISHED => Some("STATUS_CSS_KEY_NOT_ESTABLISHED"), - SMB_NTSTATUS_CSS_SCRAMBLED_SECTOR => Some("STATUS_CSS_SCRAMBLED_SECTOR"), - SMB_NTSTATUS_CSS_REGION_MISMATCH => Some("STATUS_CSS_REGION_MISMATCH"), - SMB_NTSTATUS_CSS_RESETS_EXHAUSTED => Some("STATUS_CSS_RESETS_EXHAUSTED"), - SMB_NTSTATUS_PKINIT_FAILURE => Some("STATUS_PKINIT_FAILURE"), - SMB_NTSTATUS_SMARTCARD_SUBSYSTEM_FAILURE => Some("STATUS_SMARTCARD_SUBSYSTEM_FAILURE"), - SMB_NTSTATUS_NO_KERB_KEY => Some("STATUS_NO_KERB_KEY"), - SMB_NTSTATUS_HOST_DOWN => Some("STATUS_HOST_DOWN"), - SMB_NTSTATUS_UNSUPPORTED_PREAUTH => Some("STATUS_UNSUPPORTED_PREAUTH"), - SMB_NTSTATUS_EFS_ALG_BLOB_TOO_BIG => Some("STATUS_EFS_ALG_BLOB_TOO_BIG"), - SMB_NTSTATUS_PORT_NOT_SET => Some("STATUS_PORT_NOT_SET"), - SMB_NTSTATUS_DEBUGGER_INACTIVE => Some("STATUS_DEBUGGER_INACTIVE"), - SMB_NTSTATUS_DS_VERSION_CHECK_FAILURE => Some("STATUS_DS_VERSION_CHECK_FAILURE"), - SMB_NTSTATUS_AUDITING_DISABLED => Some("STATUS_AUDITING_DISABLED"), - SMB_NTSTATUS_PRENT4_MACHINE_ACCOUNT => Some("STATUS_PRENT4_MACHINE_ACCOUNT"), - SMB_NTSTATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER => Some("STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER"), - SMB_NTSTATUS_INVALID_IMAGE_WIN_32 => Some("STATUS_INVALID_IMAGE_WIN_32"), - SMB_NTSTATUS_INVALID_IMAGE_WIN_64 => Some("STATUS_INVALID_IMAGE_WIN_64"), - SMB_NTSTATUS_BAD_BINDINGS => Some("STATUS_BAD_BINDINGS"), - SMB_NTSTATUS_NETWORK_SESSION_EXPIRED => Some("STATUS_NETWORK_SESSION_EXPIRED"), - SMB_NTSTATUS_APPHELP_BLOCK => Some("STATUS_APPHELP_BLOCK"), - SMB_NTSTATUS_ALL_SIDS_FILTERED => Some("STATUS_ALL_SIDS_FILTERED"), - SMB_NTSTATUS_NOT_SAFE_MODE_DRIVER => Some("STATUS_NOT_SAFE_MODE_DRIVER"), - SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT => Some("STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT"), - SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PATH => Some("STATUS_ACCESS_DISABLED_BY_POLICY_PATH"), - SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER => Some("STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER"), - SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_OTHER => Some("STATUS_ACCESS_DISABLED_BY_POLICY_OTHER"), - SMB_NTSTATUS_FAILED_DRIVER_ENTRY => Some("STATUS_FAILED_DRIVER_ENTRY"), - SMB_NTSTATUS_DEVICE_ENUMERATION_ERROR => Some("STATUS_DEVICE_ENUMERATION_ERROR"), - SMB_NTSTATUS_MOUNT_POINT_NOT_RESOLVED => Some("STATUS_MOUNT_POINT_NOT_RESOLVED"), - SMB_NTSTATUS_INVALID_DEVICE_OBJECT_PARAMETER => Some("STATUS_INVALID_DEVICE_OBJECT_PARAMETER"), - SMB_NTSTATUS_MCA_OCCURED => Some("STATUS_MCA_OCCURED"), - SMB_NTSTATUS_DRIVER_BLOCKED_CRITICAL => Some("STATUS_DRIVER_BLOCKED_CRITICAL"), - SMB_NTSTATUS_DRIVER_BLOCKED => Some("STATUS_DRIVER_BLOCKED"), - SMB_NTSTATUS_DRIVER_DATABASE_ERROR => Some("STATUS_DRIVER_DATABASE_ERROR"), - SMB_NTSTATUS_SYSTEM_HIVE_TOO_LARGE => Some("STATUS_SYSTEM_HIVE_TOO_LARGE"), - SMB_NTSTATUS_INVALID_IMPORT_OF_NON_DLL => Some("STATUS_INVALID_IMPORT_OF_NON_DLL"), - SMB_NTSTATUS_NO_SECRETS => Some("STATUS_NO_SECRETS"), - SMB_NTSTATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY => Some("STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY"), - SMB_NTSTATUS_FAILED_STACK_SWITCH => Some("STATUS_FAILED_STACK_SWITCH"), - SMB_NTSTATUS_HEAP_CORRUPTION => Some("STATUS_HEAP_CORRUPTION"), - SMB_NTSTATUS_SMARTCARD_WRONG_PIN => Some("STATUS_SMARTCARD_WRONG_PIN"), - SMB_NTSTATUS_SMARTCARD_CARD_BLOCKED => Some("STATUS_SMARTCARD_CARD_BLOCKED"), - SMB_NTSTATUS_SMARTCARD_CARD_NOT_AUTHENTICATED => Some("STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED"), - SMB_NTSTATUS_SMARTCARD_NO_CARD => Some("STATUS_SMARTCARD_NO_CARD"), - SMB_NTSTATUS_SMARTCARD_NO_KEY_CONTAINER => Some("STATUS_SMARTCARD_NO_KEY_CONTAINER"), - SMB_NTSTATUS_SMARTCARD_NO_CERTIFICATE => Some("STATUS_SMARTCARD_NO_CERTIFICATE"), - SMB_NTSTATUS_SMARTCARD_NO_KEYSET => Some("STATUS_SMARTCARD_NO_KEYSET"), - SMB_NTSTATUS_SMARTCARD_IO_ERROR => Some("STATUS_SMARTCARD_IO_ERROR"), - SMB_NTSTATUS_DOWNGRADE_DETECTED => Some("STATUS_DOWNGRADE_DETECTED"), - SMB_NTSTATUS_SMARTCARD_CERT_REVOKED => Some("STATUS_SMARTCARD_CERT_REVOKED"), - SMB_NTSTATUS_ISSUING_CA_UNTRUSTED => Some("STATUS_ISSUING_CA_UNTRUSTED"), - SMB_NTSTATUS_REVOCATION_OFFLINE_C => Some("STATUS_REVOCATION_OFFLINE_C"), - SMB_NTSTATUS_PKINIT_CLIENT_FAILURE => Some("STATUS_PKINIT_CLIENT_FAILURE"), - SMB_NTSTATUS_SMARTCARD_CERT_EXPIRED => Some("STATUS_SMARTCARD_CERT_EXPIRED"), - SMB_NTSTATUS_DRIVER_FAILED_PRIOR_UNLOAD => Some("STATUS_DRIVER_FAILED_PRIOR_UNLOAD"), - SMB_NTSTATUS_SMARTCARD_SILENT_CONTEXT => Some("STATUS_SMARTCARD_SILENT_CONTEXT"), - SMB_NTSTATUS_PER_USER_TRUST_QUOTA_EXCEEDED => Some("STATUS_PER_USER_TRUST_QUOTA_EXCEEDED"), - SMB_NTSTATUS_ALL_USER_TRUST_QUOTA_EXCEEDED => Some("STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED"), - SMB_NTSTATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED => Some("STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED"), - SMB_NTSTATUS_DS_NAME_NOT_UNIQUE => Some("STATUS_DS_NAME_NOT_UNIQUE"), - SMB_NTSTATUS_DS_DUPLICATE_ID_FOUND => Some("STATUS_DS_DUPLICATE_ID_FOUND"), - SMB_NTSTATUS_DS_GROUP_CONVERSION_ERROR => Some("STATUS_DS_GROUP_CONVERSION_ERROR"), - SMB_NTSTATUS_VOLSNAP_PREPARE_HIBERNATE => Some("STATUS_VOLSNAP_PREPARE_HIBERNATE"), - SMB_NTSTATUS_USER2USER_REQUIRED => Some("STATUS_USER2USER_REQUIRED"), - SMB_NTSTATUS_STACK_BUFFER_OVERRUN => Some("STATUS_STACK_BUFFER_OVERRUN"), - SMB_NTSTATUS_NO_S4U_PROT_SUPPORT => Some("STATUS_NO_S4U_PROT_SUPPORT"), - SMB_NTSTATUS_CROSSREALM_DELEGATION_FAILURE => Some("STATUS_CROSSREALM_DELEGATION_FAILURE"), - SMB_NTSTATUS_REVOCATION_OFFLINE_KDC => Some("STATUS_REVOCATION_OFFLINE_KDC"), - SMB_NTSTATUS_ISSUING_CA_UNTRUSTED_KDC => Some("STATUS_ISSUING_CA_UNTRUSTED_KDC"), - SMB_NTSTATUS_KDC_CERT_EXPIRED => Some("STATUS_KDC_CERT_EXPIRED"), - SMB_NTSTATUS_KDC_CERT_REVOKED => Some("STATUS_KDC_CERT_REVOKED"), - SMB_NTSTATUS_PARAMETER_QUOTA_EXCEEDED => Some("STATUS_PARAMETER_QUOTA_EXCEEDED"), - SMB_NTSTATUS_HIBERNATION_FAILURE => Some("STATUS_HIBERNATION_FAILURE"), - SMB_NTSTATUS_DELAY_LOAD_FAILED => Some("STATUS_DELAY_LOAD_FAILED"), - SMB_NTSTATUS_AUTHENTICATION_FIREWALL_FAILED => Some("STATUS_AUTHENTICATION_FIREWALL_FAILED"), - SMB_NTSTATUS_VDM_DISALLOWED => Some("STATUS_VDM_DISALLOWED"), - SMB_NTSTATUS_HUNG_DISPLAY_DRIVER_THREAD => Some("STATUS_HUNG_DISPLAY_DRIVER_THREAD"), - SMB_NTSTATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE => Some("STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE"), - SMB_NTSTATUS_INVALID_CRUNTIME_PARAMETER => Some("STATUS_INVALID_CRUNTIME_PARAMETER"), - SMB_NTSTATUS_NTLM_BLOCKED => Some("STATUS_NTLM_BLOCKED"), - SMB_NTSTATUS_DS_SRC_SID_EXISTS_IN_FOREST => Some("STATUS_DS_SRC_SID_EXISTS_IN_FOREST"), - SMB_NTSTATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST => Some("STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST"), - SMB_NTSTATUS_DS_FLAT_NAME_EXISTS_IN_FOREST => Some("STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST"), - SMB_NTSTATUS_INVALID_USER_PRINCIPAL_NAME => Some("STATUS_INVALID_USER_PRINCIPAL_NAME"), - SMB_NTSTATUS_ASSERTION_FAILURE => Some("STATUS_ASSERTION_FAILURE"), - SMB_NTSTATUS_VERIFIER_STOP => Some("STATUS_VERIFIER_STOP"), - SMB_NTSTATUS_CALLBACK_POP_STACK => Some("STATUS_CALLBACK_POP_STACK"), - SMB_NTSTATUS_INCOMPATIBLE_DRIVER_BLOCKED => Some("STATUS_INCOMPATIBLE_DRIVER_BLOCKED"), - SMB_NTSTATUS_HIVE_UNLOADED => Some("STATUS_HIVE_UNLOADED"), - SMB_NTSTATUS_COMPRESSION_DISABLED => Some("STATUS_COMPRESSION_DISABLED"), - SMB_NTSTATUS_FILE_SYSTEM_LIMITATION => Some("STATUS_FILE_SYSTEM_LIMITATION"), - SMB_NTSTATUS_INVALID_IMAGE_HASH => Some("STATUS_INVALID_IMAGE_HASH"), - SMB_NTSTATUS_NOT_CAPABLE => Some("STATUS_NOT_CAPABLE"), - SMB_NTSTATUS_REQUEST_OUT_OF_SEQUENCE => Some("STATUS_REQUEST_OUT_OF_SEQUENCE"), - SMB_NTSTATUS_IMPLEMENTATION_LIMIT => Some("STATUS_IMPLEMENTATION_LIMIT"), - SMB_NTSTATUS_ELEVATION_REQUIRED => Some("STATUS_ELEVATION_REQUIRED"), - SMB_NTSTATUS_NO_SECURITY_CONTEXT => Some("STATUS_NO_SECURITY_CONTEXT"), - SMB_NTSTATUS_PKU2U_CERT_FAILURE => Some("STATUS_PKU2U_CERT_FAILURE"), - SMB_NTSTATUS_BEYOND_VDL => Some("STATUS_BEYOND_VDL"), - SMB_NTSTATUS_ENCOUNTERED_WRITE_IN_PROGRESS => Some("STATUS_ENCOUNTERED_WRITE_IN_PROGRESS"), - SMB_NTSTATUS_PTE_CHANGED => Some("STATUS_PTE_CHANGED"), - SMB_NTSTATUS_PURGE_FAILED => Some("STATUS_PURGE_FAILED"), - SMB_NTSTATUS_CRED_REQUIRES_CONFIRMATION => Some("STATUS_CRED_REQUIRES_CONFIRMATION"), - SMB_NTSTATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE => Some("STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE"), - SMB_NTSTATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER => Some("STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER"), - SMB_NTSTATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE => Some("STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE"), - SMB_NTSTATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE => Some("STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE"), - SMB_NTSTATUS_CS_ENCRYPTION_FILE_NOT_CSE => Some("STATUS_CS_ENCRYPTION_FILE_NOT_CSE"), - SMB_NTSTATUS_INVALID_LABEL => Some("STATUS_INVALID_LABEL"), - SMB_NTSTATUS_DRIVER_PROCESS_TERMINATED => Some("STATUS_DRIVER_PROCESS_TERMINATED"), - SMB_NTSTATUS_AMBIGUOUS_SYSTEM_DEVICE => Some("STATUS_AMBIGUOUS_SYSTEM_DEVICE"), - SMB_NTSTATUS_SYSTEM_DEVICE_NOT_FOUND => Some("STATUS_SYSTEM_DEVICE_NOT_FOUND"), - SMB_NTSTATUS_RESTART_BOOT_APPLICATION => Some("STATUS_RESTART_BOOT_APPLICATION"), - SMB_NTSTATUS_INSUFFICIENT_NVRAM_RESOURCES => Some("STATUS_INSUFFICIENT_NVRAM_RESOURCES"), - SMB_NTSTATUS_NO_RANGES_PROCESSED => Some("STATUS_NO_RANGES_PROCESSED"), - SMB_NTSTATUS_DEVICE_FEATURE_NOT_SUPPORTED => Some("STATUS_DEVICE_FEATURE_NOT_SUPPORTED"), - SMB_NTSTATUS_DEVICE_UNREACHABLE => Some("STATUS_DEVICE_UNREACHABLE"), - SMB_NTSTATUS_INVALID_TOKEN => Some("STATUS_INVALID_TOKEN"), - SMB_NTSTATUS_SERVER_UNAVAILABLE => Some("STATUS_SERVER_UNAVAILABLE"), - SMB_NTSTATUS_INVALID_TASK_NAME => Some("STATUS_INVALID_TASK_NAME"), - SMB_NTSTATUS_INVALID_TASK_INDEX => Some("STATUS_INVALID_TASK_INDEX"), - SMB_NTSTATUS_THREAD_ALREADY_IN_TASK => Some("STATUS_THREAD_ALREADY_IN_TASK"), - SMB_NTSTATUS_CALLBACK_BYPASS => Some("STATUS_CALLBACK_BYPASS"), - SMB_NTSTATUS_FAIL_FAST_EXCEPTION => Some("STATUS_FAIL_FAST_EXCEPTION"), - SMB_NTSTATUS_IMAGE_CERT_REVOKED => Some("STATUS_IMAGE_CERT_REVOKED"), - SMB_NTSTATUS_PORT_CLOSED => Some("STATUS_PORT_CLOSED"), - SMB_NTSTATUS_MESSAGE_LOST => Some("STATUS_MESSAGE_LOST"), - SMB_NTSTATUS_INVALID_MESSAGE => Some("STATUS_INVALID_MESSAGE"), - SMB_NTSTATUS_REQUEST_CANCELED => Some("STATUS_REQUEST_CANCELED"), - SMB_NTSTATUS_RECURSIVE_DISPATCH => Some("STATUS_RECURSIVE_DISPATCH"), - SMB_NTSTATUS_LPC_RECEIVE_BUFFER_EXPECTED => Some("STATUS_LPC_RECEIVE_BUFFER_EXPECTED"), - SMB_NTSTATUS_LPC_INVALID_CONNECTION_USAGE => Some("STATUS_LPC_INVALID_CONNECTION_USAGE"), - SMB_NTSTATUS_LPC_REQUESTS_NOT_ALLOWED => Some("STATUS_LPC_REQUESTS_NOT_ALLOWED"), - SMB_NTSTATUS_RESOURCE_IN_USE => Some("STATUS_RESOURCE_IN_USE"), - SMB_NTSTATUS_HARDWARE_MEMORY_ERROR => Some("STATUS_HARDWARE_MEMORY_ERROR"), - SMB_NTSTATUS_THREADPOOL_HANDLE_EXCEPTION => Some("STATUS_THREADPOOL_HANDLE_EXCEPTION"), - SMB_NTSTATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED => Some("STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED"), - SMB_NTSTATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED => Some("STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED"), - SMB_NTSTATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED => Some("STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED"), - SMB_NTSTATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED => Some("STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED"), - SMB_NTSTATUS_THREADPOOL_RELEASED_DURING_OPERATION => Some("STATUS_THREADPOOL_RELEASED_DURING_OPERATION"), - SMB_NTSTATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING => Some("STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING"), - SMB_NTSTATUS_APC_RETURNED_WHILE_IMPERSONATING => Some("STATUS_APC_RETURNED_WHILE_IMPERSONATING"), - SMB_NTSTATUS_PROCESS_IS_PROTECTED => Some("STATUS_PROCESS_IS_PROTECTED"), - SMB_NTSTATUS_MCA_EXCEPTION => Some("STATUS_MCA_EXCEPTION"), - SMB_NTSTATUS_CERTIFICATE_MAPPING_NOT_UNIQUE => Some("STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE"), - SMB_NTSTATUS_SYMLINK_CLASS_DISABLED => Some("STATUS_SYMLINK_CLASS_DISABLED"), - SMB_NTSTATUS_INVALID_IDN_NORMALIZATION => Some("STATUS_INVALID_IDN_NORMALIZATION"), - SMB_NTSTATUS_NO_UNICODE_TRANSLATION => Some("STATUS_NO_UNICODE_TRANSLATION"), - SMB_NTSTATUS_ALREADY_REGISTERED => Some("STATUS_ALREADY_REGISTERED"), - SMB_NTSTATUS_CONTEXT_MISMATCH => Some("STATUS_CONTEXT_MISMATCH"), - SMB_NTSTATUS_PORT_ALREADY_HAS_COMPLETION_LIST => Some("STATUS_PORT_ALREADY_HAS_COMPLETION_LIST"), - SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_PRIORITY => Some("STATUS_CALLBACK_RETURNED_THREAD_PRIORITY"), - SMB_NTSTATUS_INVALID_THREAD => Some("STATUS_INVALID_THREAD"), - SMB_NTSTATUS_CALLBACK_RETURNED_TRANSACTION => Some("STATUS_CALLBACK_RETURNED_TRANSACTION"), - SMB_NTSTATUS_CALLBACK_RETURNED_LDR_LOCK => Some("STATUS_CALLBACK_RETURNED_LDR_LOCK"), - SMB_NTSTATUS_CALLBACK_RETURNED_LANG => Some("STATUS_CALLBACK_RETURNED_LANG"), - SMB_NTSTATUS_CALLBACK_RETURNED_PRI_BACK => Some("STATUS_CALLBACK_RETURNED_PRI_BACK"), - SMB_NTSTATUS_DISK_REPAIR_DISABLED => Some("STATUS_DISK_REPAIR_DISABLED"), - SMB_NTSTATUS_DS_DOMAIN_RENAME_IN_PROGRESS => Some("STATUS_DS_DOMAIN_RENAME_IN_PROGRESS"), - SMB_NTSTATUS_DISK_QUOTA_EXCEEDED => Some("STATUS_DISK_QUOTA_EXCEEDED"), - SMB_NTSTATUS_CONTENT_BLOCKED => Some("STATUS_CONTENT_BLOCKED"), - SMB_NTSTATUS_BAD_CLUSTERS => Some("STATUS_BAD_CLUSTERS"), - SMB_NTSTATUS_VOLUME_DIRTY => Some("STATUS_VOLUME_DIRTY"), - SMB_NTSTATUS_FILE_CHECKED_OUT => Some("STATUS_FILE_CHECKED_OUT"), - SMB_NTSTATUS_CHECKOUT_REQUIRED => Some("STATUS_CHECKOUT_REQUIRED"), - SMB_NTSTATUS_BAD_FILE_TYPE => Some("STATUS_BAD_FILE_TYPE"), - SMB_NTSTATUS_FILE_TOO_LARGE => Some("STATUS_FILE_TOO_LARGE"), - SMB_NTSTATUS_FORMS_AUTH_REQUIRED => Some("STATUS_FORMS_AUTH_REQUIRED"), - SMB_NTSTATUS_VIRUS_INFECTED => Some("STATUS_VIRUS_INFECTED"), - SMB_NTSTATUS_VIRUS_DELETED => Some("STATUS_VIRUS_DELETED"), - SMB_NTSTATUS_BAD_MCFG_TABLE => Some("STATUS_BAD_MCFG_TABLE"), - SMB_NTSTATUS_CANNOT_BREAK_OPLOCK => Some("STATUS_CANNOT_BREAK_OPLOCK"), - SMB_NTSTATUS_WOW_ASSERTION => Some("STATUS_WOW_ASSERTION"), - SMB_NTSTATUS_INVALID_SIGNATURE => Some("STATUS_INVALID_SIGNATURE"), - SMB_NTSTATUS_HMAC_NOT_SUPPORTED => Some("STATUS_HMAC_NOT_SUPPORTED"), - SMB_NTSTATUS_IPSEC_QUEUE_OVERFLOW => Some("STATUS_IPSEC_QUEUE_OVERFLOW"), - SMB_NTSTATUS_ND_QUEUE_OVERFLOW => Some("STATUS_ND_QUEUE_OVERFLOW"), - SMB_NTSTATUS_HOPLIMIT_EXCEEDED => Some("STATUS_HOPLIMIT_EXCEEDED"), - SMB_NTSTATUS_PROTOCOL_NOT_SUPPORTED => Some("STATUS_PROTOCOL_NOT_SUPPORTED"), - SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED => Some("STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED"), - SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR => Some("STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR"), - SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR => Some("STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR"), - SMB_NTSTATUS_XML_PARSE_ERROR => Some("STATUS_XML_PARSE_ERROR"), - SMB_NTSTATUS_XMLDSIG_ERROR => Some("STATUS_XMLDSIG_ERROR"), - SMB_NTSTATUS_WRONG_COMPARTMENT => Some("STATUS_WRONG_COMPARTMENT"), - SMB_NTSTATUS_AUTHIP_FAILURE => Some("STATUS_AUTHIP_FAILURE"), - SMB_NTSTATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS => Some("STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS"), - SMB_NTSTATUS_DS_OID_NOT_FOUND => Some("STATUS_DS_OID_NOT_FOUND"), - SMB_NTSTATUS_HASH_NOT_SUPPORTED => Some("STATUS_HASH_NOT_SUPPORTED"), - SMB_NTSTATUS_HASH_NOT_PRESENT => Some("STATUS_HASH_NOT_PRESENT"), - SMB_NTSTATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED => Some("STATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED"), - SMB_NTSTATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED => Some("STATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED"), - SMB_NTSTATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED => Some("STATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED"), - SMB_NTSTATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED => Some("STATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED"), - SMB_NTDBG_NO_STATE_CHANGE => Some("DBG_NO_STATE_CHANGE"), - SMB_NTDBG_APP_NOT_IDLE => Some("DBG_APP_NOT_IDLE"), - SMB_NTRPC_NT_INVALID_STRING_BINDING => Some("RPC_NT_INVALID_STRING_BINDING"), - SMB_NTRPC_NT_WRONG_KIND_OF_BINDING => Some("RPC_NT_WRONG_KIND_OF_BINDING"), - SMB_NTRPC_NT_INVALID_BINDING => Some("RPC_NT_INVALID_BINDING"), - SMB_NTRPC_NT_PROTSEQ_NOT_SUPPORTED => Some("RPC_NT_PROTSEQ_NOT_SUPPORTED"), - SMB_NTRPC_NT_INVALID_RPC_PROTSEQ => Some("RPC_NT_INVALID_RPC_PROTSEQ"), - SMB_NTRPC_NT_INVALID_STRING_UUID => Some("RPC_NT_INVALID_STRING_UUID"), - SMB_NTRPC_NT_INVALID_ENDPOINT_FORMAT => Some("RPC_NT_INVALID_ENDPOINT_FORMAT"), - SMB_NTRPC_NT_INVALID_NET_ADDR => Some("RPC_NT_INVALID_NET_ADDR"), - SMB_NTRPC_NT_NO_ENDPOINT_FOUND => Some("RPC_NT_NO_ENDPOINT_FOUND"), - SMB_NTRPC_NT_INVALID_TIMEOUT => Some("RPC_NT_INVALID_TIMEOUT"), - SMB_NTRPC_NT_OBJECT_NOT_FOUND => Some("RPC_NT_OBJECT_NOT_FOUND"), - SMB_NTRPC_NT_ALREADY_REGISTERED => Some("RPC_NT_ALREADY_REGISTERED"), - SMB_NTRPC_NT_TYPE_ALREADY_REGISTERED => Some("RPC_NT_TYPE_ALREADY_REGISTERED"), - SMB_NTRPC_NT_ALREADY_LISTENING => Some("RPC_NT_ALREADY_LISTENING"), - SMB_NTRPC_NT_NO_PROTSEQS_REGISTERED => Some("RPC_NT_NO_PROTSEQS_REGISTERED"), - SMB_NTRPC_NT_NOT_LISTENING => Some("RPC_NT_NOT_LISTENING"), - SMB_NTRPC_NT_UNKNOWN_MGR_TYPE => Some("RPC_NT_UNKNOWN_MGR_TYPE"), - SMB_NTRPC_NT_UNKNOWN_IF => Some("RPC_NT_UNKNOWN_IF"), - SMB_NTRPC_NT_NO_BINDINGS => Some("RPC_NT_NO_BINDINGS"), - SMB_NTRPC_NT_NO_PROTSEQS => Some("RPC_NT_NO_PROTSEQS"), - SMB_NTRPC_NT_CANT_CREATE_ENDPOINT => Some("RPC_NT_CANT_CREATE_ENDPOINT"), - SMB_NTRPC_NT_OUT_OF_RESOURCES => Some("RPC_NT_OUT_OF_RESOURCES"), - SMB_NTRPC_NT_SERVER_UNAVAILABLE => Some("RPC_NT_SERVER_UNAVAILABLE"), - SMB_NTRPC_NT_SERVER_TOO_BUSY => Some("RPC_NT_SERVER_TOO_BUSY"), - SMB_NTRPC_NT_INVALID_NETWORK_OPTIONS => Some("RPC_NT_INVALID_NETWORK_OPTIONS"), - SMB_NTRPC_NT_NO_CALL_ACTIVE => Some("RPC_NT_NO_CALL_ACTIVE"), - SMB_NTRPC_NT_CALL_FAILED => Some("RPC_NT_CALL_FAILED"), - SMB_NTRPC_NT_CALL_FAILED_DNE => Some("RPC_NT_CALL_FAILED_DNE"), - SMB_NTRPC_NT_PROTOCOL_ERROR => Some("RPC_NT_PROTOCOL_ERROR"), - SMB_NTRPC_NT_UNSUPPORTED_TRANS_SYN => Some("RPC_NT_UNSUPPORTED_TRANS_SYN"), - SMB_NTRPC_NT_UNSUPPORTED_TYPE => Some("RPC_NT_UNSUPPORTED_TYPE"), - SMB_NTRPC_NT_INVALID_TAG => Some("RPC_NT_INVALID_TAG"), - SMB_NTRPC_NT_INVALID_BOUND => Some("RPC_NT_INVALID_BOUND"), - SMB_NTRPC_NT_NO_ENTRY_NAME => Some("RPC_NT_NO_ENTRY_NAME"), - SMB_NTRPC_NT_INVALID_NAME_SYNTAX => Some("RPC_NT_INVALID_NAME_SYNTAX"), - SMB_NTRPC_NT_UNSUPPORTED_NAME_SYNTAX => Some("RPC_NT_UNSUPPORTED_NAME_SYNTAX"), - SMB_NTRPC_NT_UUID_NO_ADDRESS => Some("RPC_NT_UUID_NO_ADDRESS"), - SMB_NTRPC_NT_DUPLICATE_ENDPOINT => Some("RPC_NT_DUPLICATE_ENDPOINT"), - SMB_NTRPC_NT_UNKNOWN_AUTHN_TYPE => Some("RPC_NT_UNKNOWN_AUTHN_TYPE"), - SMB_NTRPC_NT_MAX_CALLS_TOO_SMALL => Some("RPC_NT_MAX_CALLS_TOO_SMALL"), - SMB_NTRPC_NT_STRING_TOO_LONG => Some("RPC_NT_STRING_TOO_LONG"), - SMB_NTRPC_NT_PROTSEQ_NOT_FOUND => Some("RPC_NT_PROTSEQ_NOT_FOUND"), - SMB_NTRPC_NT_PROCNUM_OUT_OF_RANGE => Some("RPC_NT_PROCNUM_OUT_OF_RANGE"), - SMB_NTRPC_NT_BINDING_HAS_NO_AUTH => Some("RPC_NT_BINDING_HAS_NO_AUTH"), - SMB_NTRPC_NT_UNKNOWN_AUTHN_SERVICE => Some("RPC_NT_UNKNOWN_AUTHN_SERVICE"), - SMB_NTRPC_NT_UNKNOWN_AUTHN_LEVEL => Some("RPC_NT_UNKNOWN_AUTHN_LEVEL"), - SMB_NTRPC_NT_INVALID_AUTH_IDENTITY => Some("RPC_NT_INVALID_AUTH_IDENTITY"), - SMB_NTRPC_NT_UNKNOWN_AUTHZ_SERVICE => Some("RPC_NT_UNKNOWN_AUTHZ_SERVICE"), - SMB_NTEPT_NT_INVALID_ENTRY => Some("EPT_NT_INVALID_ENTRY"), - SMB_NTEPT_NT_CANT_PERFORM_OP => Some("EPT_NT_CANT_PERFORM_OP"), - SMB_NTEPT_NT_NOT_REGISTERED => Some("EPT_NT_NOT_REGISTERED"), - SMB_NTRPC_NT_NOTHING_TO_EXPORT => Some("RPC_NT_NOTHING_TO_EXPORT"), - SMB_NTRPC_NT_INCOMPLETE_NAME => Some("RPC_NT_INCOMPLETE_NAME"), - SMB_NTRPC_NT_INVALID_VERS_OPTION => Some("RPC_NT_INVALID_VERS_OPTION"), - SMB_NTRPC_NT_NO_MORE_MEMBERS => Some("RPC_NT_NO_MORE_MEMBERS"), - SMB_NTRPC_NT_NOT_ALL_OBJS_UNEXPORTED => Some("RPC_NT_NOT_ALL_OBJS_UNEXPORTED"), - SMB_NTRPC_NT_INTERFACE_NOT_FOUND => Some("RPC_NT_INTERFACE_NOT_FOUND"), - SMB_NTRPC_NT_ENTRY_ALREADY_EXISTS => Some("RPC_NT_ENTRY_ALREADY_EXISTS"), - SMB_NTRPC_NT_ENTRY_NOT_FOUND => Some("RPC_NT_ENTRY_NOT_FOUND"), - SMB_NTRPC_NT_NAME_SERVICE_UNAVAILABLE => Some("RPC_NT_NAME_SERVICE_UNAVAILABLE"), - SMB_NTRPC_NT_INVALID_NAF_ID => Some("RPC_NT_INVALID_NAF_ID"), - SMB_NTRPC_NT_CANNOT_SUPPORT => Some("RPC_NT_CANNOT_SUPPORT"), - SMB_NTRPC_NT_NO_CONTEXT_AVAILABLE => Some("RPC_NT_NO_CONTEXT_AVAILABLE"), - SMB_NTRPC_NT_INTERNAL_ERROR => Some("RPC_NT_INTERNAL_ERROR"), - SMB_NTRPC_NT_ZERO_DIVIDE => Some("RPC_NT_ZERO_DIVIDE"), - SMB_NTRPC_NT_ADDRESS_ERROR => Some("RPC_NT_ADDRESS_ERROR"), - SMB_NTRPC_NT_FP_DIV_ZERO => Some("RPC_NT_FP_DIV_ZERO"), - SMB_NTRPC_NT_FP_UNDERFLOW => Some("RPC_NT_FP_UNDERFLOW"), - SMB_NTRPC_NT_FP_OVERFLOW => Some("RPC_NT_FP_OVERFLOW"), - SMB_NTRPC_NT_CALL_IN_PROGRESS => Some("RPC_NT_CALL_IN_PROGRESS"), - SMB_NTRPC_NT_NO_MORE_BINDINGS => Some("RPC_NT_NO_MORE_BINDINGS"), - SMB_NTRPC_NT_GROUP_MEMBER_NOT_FOUND => Some("RPC_NT_GROUP_MEMBER_NOT_FOUND"), - SMB_NTEPT_NT_CANT_CREATE => Some("EPT_NT_CANT_CREATE"), - SMB_NTRPC_NT_INVALID_OBJECT => Some("RPC_NT_INVALID_OBJECT"), - SMB_NTRPC_NT_NO_INTERFACES => Some("RPC_NT_NO_INTERFACES"), - SMB_NTRPC_NT_CALL_CANCELLED => Some("RPC_NT_CALL_CANCELLED"), - SMB_NTRPC_NT_BINDING_INCOMPLETE => Some("RPC_NT_BINDING_INCOMPLETE"), - SMB_NTRPC_NT_COMM_FAILURE => Some("RPC_NT_COMM_FAILURE"), - SMB_NTRPC_NT_UNSUPPORTED_AUTHN_LEVEL => Some("RPC_NT_UNSUPPORTED_AUTHN_LEVEL"), - SMB_NTRPC_NT_NO_PRINC_NAME => Some("RPC_NT_NO_PRINC_NAME"), - SMB_NTRPC_NT_NOT_RPC_ERROR => Some("RPC_NT_NOT_RPC_ERROR"), - SMB_NTRPC_NT_SEC_PKG_ERROR => Some("RPC_NT_SEC_PKG_ERROR"), - SMB_NTRPC_NT_NOT_CANCELLED => Some("RPC_NT_NOT_CANCELLED"), - SMB_NTRPC_NT_INVALID_ASYNC_HANDLE => Some("RPC_NT_INVALID_ASYNC_HANDLE"), - SMB_NTRPC_NT_INVALID_ASYNC_CALL => Some("RPC_NT_INVALID_ASYNC_CALL"), - SMB_NTRPC_NT_PROXY_ACCESS_DENIED => Some("RPC_NT_PROXY_ACCESS_DENIED"), - SMB_NTRPC_NT_NO_MORE_ENTRIES => Some("RPC_NT_NO_MORE_ENTRIES"), - SMB_NTRPC_NT_SS_CHAR_TRANS_OPEN_FAIL => Some("RPC_NT_SS_CHAR_TRANS_OPEN_FAIL"), - SMB_NTRPC_NT_SS_CHAR_TRANS_SHORT_FILE => Some("RPC_NT_SS_CHAR_TRANS_SHORT_FILE"), - SMB_NTRPC_NT_SS_IN_NULL_CONTEXT => Some("RPC_NT_SS_IN_NULL_CONTEXT"), - SMB_NTRPC_NT_SS_CONTEXT_MISMATCH => Some("RPC_NT_SS_CONTEXT_MISMATCH"), - SMB_NTRPC_NT_SS_CONTEXT_DAMAGED => Some("RPC_NT_SS_CONTEXT_DAMAGED"), - SMB_NTRPC_NT_SS_HANDLES_MISMATCH => Some("RPC_NT_SS_HANDLES_MISMATCH"), - SMB_NTRPC_NT_SS_CANNOT_GET_CALL_HANDLE => Some("RPC_NT_SS_CANNOT_GET_CALL_HANDLE"), - SMB_NTRPC_NT_NULL_REF_POINTER => Some("RPC_NT_NULL_REF_POINTER"), - SMB_NTRPC_NT_ENUM_VALUE_OUT_OF_RANGE => Some("RPC_NT_ENUM_VALUE_OUT_OF_RANGE"), - SMB_NTRPC_NT_BYTE_COUNT_TOO_SMALL => Some("RPC_NT_BYTE_COUNT_TOO_SMALL"), - SMB_NTRPC_NT_BAD_STUB_DATA => Some("RPC_NT_BAD_STUB_DATA"), - SMB_NTRPC_NT_INVALID_ES_ACTION => Some("RPC_NT_INVALID_ES_ACTION"), - SMB_NTRPC_NT_WRONG_ES_VERSION => Some("RPC_NT_WRONG_ES_VERSION"), - SMB_NTRPC_NT_WRONG_STUB_VERSION => Some("RPC_NT_WRONG_STUB_VERSION"), - SMB_NTRPC_NT_INVALID_PIPE_OBJECT => Some("RPC_NT_INVALID_PIPE_OBJECT"), - SMB_NTRPC_NT_INVALID_PIPE_OPERATION => Some("RPC_NT_INVALID_PIPE_OPERATION"), - SMB_NTRPC_NT_WRONG_PIPE_VERSION => Some("RPC_NT_WRONG_PIPE_VERSION"), - SMB_NTRPC_NT_PIPE_CLOSED => Some("RPC_NT_PIPE_CLOSED"), - SMB_NTRPC_NT_PIPE_DISCIPLINE_ERROR => Some("RPC_NT_PIPE_DISCIPLINE_ERROR"), - SMB_NTRPC_NT_PIPE_EMPTY => Some("RPC_NT_PIPE_EMPTY"), - SMB_NTSTATUS_PNP_BAD_MPS_TABLE => Some("STATUS_PNP_BAD_MPS_TABLE"), - SMB_NTSTATUS_PNP_TRANSLATION_FAILED => Some("STATUS_PNP_TRANSLATION_FAILED"), - SMB_NTSTATUS_PNP_IRQ_TRANSLATION_FAILED => Some("STATUS_PNP_IRQ_TRANSLATION_FAILED"), - SMB_NTSTATUS_PNP_INVALID_ID => Some("STATUS_PNP_INVALID_ID"), - SMB_NTSTATUS_IO_REISSUE_AS_CACHED => Some("STATUS_IO_REISSUE_AS_CACHED"), - SMB_NTSTATUS_CTX_WINSTATION_NAME_INVALID => Some("STATUS_CTX_WINSTATION_NAME_INVALID"), - SMB_NTSTATUS_CTX_INVALID_PD => Some("STATUS_CTX_INVALID_PD"), - SMB_NTSTATUS_CTX_PD_NOT_FOUND => Some("STATUS_CTX_PD_NOT_FOUND"), - SMB_NTSTATUS_CTX_CLOSE_PENDING => Some("STATUS_CTX_CLOSE_PENDING"), - SMB_NTSTATUS_CTX_NO_OUTBUF => Some("STATUS_CTX_NO_OUTBUF"), - SMB_NTSTATUS_CTX_MODEM_INF_NOT_FOUND => Some("STATUS_CTX_MODEM_INF_NOT_FOUND"), - SMB_NTSTATUS_CTX_INVALID_MODEMNAME => Some("STATUS_CTX_INVALID_MODEMNAME"), - SMB_NTSTATUS_CTX_RESPONSE_ERROR => Some("STATUS_CTX_RESPONSE_ERROR"), - SMB_NTSTATUS_CTX_MODEM_RESPONSE_TIMEOUT => Some("STATUS_CTX_MODEM_RESPONSE_TIMEOUT"), - SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_CARRIER => Some("STATUS_CTX_MODEM_RESPONSE_NO_CARRIER"), - SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_DIALTONE => Some("STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE"), - SMB_NTSTATUS_CTX_MODEM_RESPONSE_BUSY => Some("STATUS_CTX_MODEM_RESPONSE_BUSY"), - SMB_NTSTATUS_CTX_MODEM_RESPONSE_VOICE => Some("STATUS_CTX_MODEM_RESPONSE_VOICE"), - SMB_NTSTATUS_CTX_TD_ERROR => Some("STATUS_CTX_TD_ERROR"), - SMB_NTSTATUS_CTX_LICENSE_CLIENT_INVALID => Some("STATUS_CTX_LICENSE_CLIENT_INVALID"), - SMB_NTSTATUS_CTX_LICENSE_NOT_AVAILABLE => Some("STATUS_CTX_LICENSE_NOT_AVAILABLE"), - SMB_NTSTATUS_CTX_LICENSE_EXPIRED => Some("STATUS_CTX_LICENSE_EXPIRED"), - SMB_NTSTATUS_CTX_WINSTATION_NOT_FOUND => Some("STATUS_CTX_WINSTATION_NOT_FOUND"), - SMB_NTSTATUS_CTX_WINSTATION_NAME_COLLISION => Some("STATUS_CTX_WINSTATION_NAME_COLLISION"), - SMB_NTSTATUS_CTX_WINSTATION_BUSY => Some("STATUS_CTX_WINSTATION_BUSY"), - SMB_NTSTATUS_CTX_BAD_VIDEO_MODE => Some("STATUS_CTX_BAD_VIDEO_MODE"), - SMB_NTSTATUS_CTX_GRAPHICS_INVALID => Some("STATUS_CTX_GRAPHICS_INVALID"), - SMB_NTSTATUS_CTX_NOT_CONSOLE => Some("STATUS_CTX_NOT_CONSOLE"), - SMB_NTSTATUS_CTX_CLIENT_QUERY_TIMEOUT => Some("STATUS_CTX_CLIENT_QUERY_TIMEOUT"), - SMB_NTSTATUS_CTX_CONSOLE_DISCONNECT => Some("STATUS_CTX_CONSOLE_DISCONNECT"), - SMB_NTSTATUS_CTX_CONSOLE_CONNECT => Some("STATUS_CTX_CONSOLE_CONNECT"), - SMB_NTSTATUS_CTX_SHADOW_DENIED => Some("STATUS_CTX_SHADOW_DENIED"), - SMB_NTSTATUS_CTX_WINSTATION_ACCESS_DENIED => Some("STATUS_CTX_WINSTATION_ACCESS_DENIED"), - SMB_NTSTATUS_CTX_INVALID_WD => Some("STATUS_CTX_INVALID_WD"), - SMB_NTSTATUS_CTX_WD_NOT_FOUND => Some("STATUS_CTX_WD_NOT_FOUND"), - SMB_NTSTATUS_CTX_SHADOW_INVALID => Some("STATUS_CTX_SHADOW_INVALID"), - SMB_NTSTATUS_CTX_SHADOW_DISABLED => Some("STATUS_CTX_SHADOW_DISABLED"), - SMB_NTSTATUS_RDP_PROTOCOL_ERROR => Some("STATUS_RDP_PROTOCOL_ERROR"), - SMB_NTSTATUS_CTX_CLIENT_LICENSE_NOT_SET => Some("STATUS_CTX_CLIENT_LICENSE_NOT_SET"), - SMB_NTSTATUS_CTX_CLIENT_LICENSE_IN_USE => Some("STATUS_CTX_CLIENT_LICENSE_IN_USE"), - SMB_NTSTATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE => Some("STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE"), - SMB_NTSTATUS_CTX_SHADOW_NOT_RUNNING => Some("STATUS_CTX_SHADOW_NOT_RUNNING"), - SMB_NTSTATUS_CTX_LOGON_DISABLED => Some("STATUS_CTX_LOGON_DISABLED"), - SMB_NTSTATUS_CTX_SECURITY_LAYER_ERROR => Some("STATUS_CTX_SECURITY_LAYER_ERROR"), - SMB_NTSTATUS_TS_INCOMPATIBLE_SESSIONS => Some("STATUS_TS_INCOMPATIBLE_SESSIONS"), - SMB_NTSTATUS_MUI_FILE_NOT_FOUND => Some("STATUS_MUI_FILE_NOT_FOUND"), - SMB_NTSTATUS_MUI_INVALID_FILE => Some("STATUS_MUI_INVALID_FILE"), - SMB_NTSTATUS_MUI_INVALID_RC_CONFIG => Some("STATUS_MUI_INVALID_RC_CONFIG"), - SMB_NTSTATUS_MUI_INVALID_LOCALE_NAME => Some("STATUS_MUI_INVALID_LOCALE_NAME"), - SMB_NTSTATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME => Some("STATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME"), - SMB_NTSTATUS_MUI_FILE_NOT_LOADED => Some("STATUS_MUI_FILE_NOT_LOADED"), - SMB_NTSTATUS_RESOURCE_ENUM_USER_STOP => Some("STATUS_RESOURCE_ENUM_USER_STOP"), - SMB_NTSTATUS_CLUSTER_INVALID_NODE => Some("STATUS_CLUSTER_INVALID_NODE"), - SMB_NTSTATUS_CLUSTER_NODE_EXISTS => Some("STATUS_CLUSTER_NODE_EXISTS"), - SMB_NTSTATUS_CLUSTER_JOIN_IN_PROGRESS => Some("STATUS_CLUSTER_JOIN_IN_PROGRESS"), - SMB_NTSTATUS_CLUSTER_NODE_NOT_FOUND => Some("STATUS_CLUSTER_NODE_NOT_FOUND"), - SMB_NTSTATUS_CLUSTER_LOCAL_NODE_NOT_FOUND => Some("STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND"), - SMB_NTSTATUS_CLUSTER_NETWORK_EXISTS => Some("STATUS_CLUSTER_NETWORK_EXISTS"), - SMB_NTSTATUS_CLUSTER_NETWORK_NOT_FOUND => Some("STATUS_CLUSTER_NETWORK_NOT_FOUND"), - SMB_NTSTATUS_CLUSTER_NETINTERFACE_EXISTS => Some("STATUS_CLUSTER_NETINTERFACE_EXISTS"), - SMB_NTSTATUS_CLUSTER_NETINTERFACE_NOT_FOUND => Some("STATUS_CLUSTER_NETINTERFACE_NOT_FOUND"), - SMB_NTSTATUS_CLUSTER_INVALID_REQUEST => Some("STATUS_CLUSTER_INVALID_REQUEST"), - SMB_NTSTATUS_CLUSTER_INVALID_NETWORK_PROVIDER => Some("STATUS_CLUSTER_INVALID_NETWORK_PROVIDER"), - SMB_NTSTATUS_CLUSTER_NODE_DOWN => Some("STATUS_CLUSTER_NODE_DOWN"), - SMB_NTSTATUS_CLUSTER_NODE_UNREACHABLE => Some("STATUS_CLUSTER_NODE_UNREACHABLE"), - SMB_NTSTATUS_CLUSTER_NODE_NOT_MEMBER => Some("STATUS_CLUSTER_NODE_NOT_MEMBER"), - SMB_NTSTATUS_CLUSTER_JOIN_NOT_IN_PROGRESS => Some("STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS"), - SMB_NTSTATUS_CLUSTER_INVALID_NETWORK => Some("STATUS_CLUSTER_INVALID_NETWORK"), - SMB_NTSTATUS_CLUSTER_NO_NET_ADAPTERS => Some("STATUS_CLUSTER_NO_NET_ADAPTERS"), - SMB_NTSTATUS_CLUSTER_NODE_UP => Some("STATUS_CLUSTER_NODE_UP"), - SMB_NTSTATUS_CLUSTER_NODE_PAUSED => Some("STATUS_CLUSTER_NODE_PAUSED"), - SMB_NTSTATUS_CLUSTER_NODE_NOT_PAUSED => Some("STATUS_CLUSTER_NODE_NOT_PAUSED"), - SMB_NTSTATUS_CLUSTER_NO_SECURITY_CONTEXT => Some("STATUS_CLUSTER_NO_SECURITY_CONTEXT"), - SMB_NTSTATUS_CLUSTER_NETWORK_NOT_INTERNAL => Some("STATUS_CLUSTER_NETWORK_NOT_INTERNAL"), - SMB_NTSTATUS_CLUSTER_POISONED => Some("STATUS_CLUSTER_POISONED"), - SMB_NTSTATUS_ACPI_INVALID_OPCODE => Some("STATUS_ACPI_INVALID_OPCODE"), - SMB_NTSTATUS_ACPI_STACK_OVERFLOW => Some("STATUS_ACPI_STACK_OVERFLOW"), - SMB_NTSTATUS_ACPI_ASSERT_FAILED => Some("STATUS_ACPI_ASSERT_FAILED"), - SMB_NTSTATUS_ACPI_INVALID_INDEX => Some("STATUS_ACPI_INVALID_INDEX"), - SMB_NTSTATUS_ACPI_INVALID_ARGUMENT => Some("STATUS_ACPI_INVALID_ARGUMENT"), - SMB_NTSTATUS_ACPI_FATAL => Some("STATUS_ACPI_FATAL"), - SMB_NTSTATUS_ACPI_INVALID_SUPERNAME => Some("STATUS_ACPI_INVALID_SUPERNAME"), - SMB_NTSTATUS_ACPI_INVALID_ARGTYPE => Some("STATUS_ACPI_INVALID_ARGTYPE"), - SMB_NTSTATUS_ACPI_INVALID_OBJTYPE => Some("STATUS_ACPI_INVALID_OBJTYPE"), - SMB_NTSTATUS_ACPI_INVALID_TARGETTYPE => Some("STATUS_ACPI_INVALID_TARGETTYPE"), - SMB_NTSTATUS_ACPI_INCORRECT_ARGUMENT_COUNT => Some("STATUS_ACPI_INCORRECT_ARGUMENT_COUNT"), - SMB_NTSTATUS_ACPI_ADDRESS_NOT_MAPPED => Some("STATUS_ACPI_ADDRESS_NOT_MAPPED"), - SMB_NTSTATUS_ACPI_INVALID_EVENTTYPE => Some("STATUS_ACPI_INVALID_EVENTTYPE"), - SMB_NTSTATUS_ACPI_HANDLER_COLLISION => Some("STATUS_ACPI_HANDLER_COLLISION"), - SMB_NTSTATUS_ACPI_INVALID_DATA => Some("STATUS_ACPI_INVALID_DATA"), - SMB_NTSTATUS_ACPI_INVALID_REGION => Some("STATUS_ACPI_INVALID_REGION"), - SMB_NTSTATUS_ACPI_INVALID_ACCESS_SIZE => Some("STATUS_ACPI_INVALID_ACCESS_SIZE"), - SMB_NTSTATUS_ACPI_ACQUIRE_GLOBAL_LOCK => Some("STATUS_ACPI_ACQUIRE_GLOBAL_LOCK"), - SMB_NTSTATUS_ACPI_ALREADY_INITIALIZED => Some("STATUS_ACPI_ALREADY_INITIALIZED"), - SMB_NTSTATUS_ACPI_NOT_INITIALIZED => Some("STATUS_ACPI_NOT_INITIALIZED"), - SMB_NTSTATUS_ACPI_INVALID_MUTEX_LEVEL => Some("STATUS_ACPI_INVALID_MUTEX_LEVEL"), - SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNED => Some("STATUS_ACPI_MUTEX_NOT_OWNED"), - SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNER => Some("STATUS_ACPI_MUTEX_NOT_OWNER"), - SMB_NTSTATUS_ACPI_RS_ACCESS => Some("STATUS_ACPI_RS_ACCESS"), - SMB_NTSTATUS_ACPI_INVALID_TABLE => Some("STATUS_ACPI_INVALID_TABLE"), - SMB_NTSTATUS_ACPI_REG_HANDLER_FAILED => Some("STATUS_ACPI_REG_HANDLER_FAILED"), - SMB_NTSTATUS_ACPI_POWER_REQUEST_FAILED => Some("STATUS_ACPI_POWER_REQUEST_FAILED"), - SMB_NTSTATUS_SXS_SECTION_NOT_FOUND => Some("STATUS_SXS_SECTION_NOT_FOUND"), - SMB_NTSTATUS_SXS_CANT_GEN_ACTCTX => Some("STATUS_SXS_CANT_GEN_ACTCTX"), - SMB_NTSTATUS_SXS_INVALID_ACTCTXDATA_FORMAT => Some("STATUS_SXS_INVALID_ACTCTXDATA_FORMAT"), - SMB_NTSTATUS_SXS_ASSEMBLY_NOT_FOUND => Some("STATUS_SXS_ASSEMBLY_NOT_FOUND"), - SMB_NTSTATUS_SXS_MANIFEST_FORMAT_ERROR => Some("STATUS_SXS_MANIFEST_FORMAT_ERROR"), - SMB_NTSTATUS_SXS_MANIFEST_PARSE_ERROR => Some("STATUS_SXS_MANIFEST_PARSE_ERROR"), - SMB_NTSTATUS_SXS_ACTIVATION_CONTEXT_DISABLED => Some("STATUS_SXS_ACTIVATION_CONTEXT_DISABLED"), - SMB_NTSTATUS_SXS_KEY_NOT_FOUND => Some("STATUS_SXS_KEY_NOT_FOUND"), - SMB_NTSTATUS_SXS_VERSION_CONFLICT => Some("STATUS_SXS_VERSION_CONFLICT"), - SMB_NTSTATUS_SXS_WRONG_SECTION_TYPE => Some("STATUS_SXS_WRONG_SECTION_TYPE"), - SMB_NTSTATUS_SXS_THREAD_QUERIES_DISABLED => Some("STATUS_SXS_THREAD_QUERIES_DISABLED"), - SMB_NTSTATUS_SXS_ASSEMBLY_MISSING => Some("STATUS_SXS_ASSEMBLY_MISSING"), - SMB_NTSTATUS_SXS_PROCESS_DEFAULT_ALREADY_SET => Some("STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET"), - SMB_NTSTATUS_SXS_EARLY_DEACTIVATION => Some("STATUS_SXS_EARLY_DEACTIVATION"), - SMB_NTSTATUS_SXS_INVALID_DEACTIVATION => Some("STATUS_SXS_INVALID_DEACTIVATION"), - SMB_NTSTATUS_SXS_MULTIPLE_DEACTIVATION => Some("STATUS_SXS_MULTIPLE_DEACTIVATION"), - SMB_NTSTATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY => Some("STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY"), - SMB_NTSTATUS_SXS_PROCESS_TERMINATION_REQUESTED => Some("STATUS_SXS_PROCESS_TERMINATION_REQUESTED"), - SMB_NTSTATUS_SXS_CORRUPT_ACTIVATION_STACK => Some("STATUS_SXS_CORRUPT_ACTIVATION_STACK"), - SMB_NTSTATUS_SXS_CORRUPTION => Some("STATUS_SXS_CORRUPTION"), - SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE => Some("STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE"), - SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME => Some("STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME"), - SMB_NTSTATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE => Some("STATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE"), - SMB_NTSTATUS_SXS_IDENTITY_PARSE_ERROR => Some("STATUS_SXS_IDENTITY_PARSE_ERROR"), - SMB_NTSTATUS_SXS_COMPONENT_STORE_CORRUPT => Some("STATUS_SXS_COMPONENT_STORE_CORRUPT"), - SMB_NTSTATUS_SXS_FILE_HASH_MISMATCH => Some("STATUS_SXS_FILE_HASH_MISMATCH"), - SMB_NTSTATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT => Some("STATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT"), - SMB_NTSTATUS_SXS_IDENTITIES_DIFFERENT => Some("STATUS_SXS_IDENTITIES_DIFFERENT"), - SMB_NTSTATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT => Some("STATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT"), - SMB_NTSTATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY => Some("STATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY"), - SMB_NTSTATUS_ADVANCED_INSTALLER_FAILED => Some("STATUS_ADVANCED_INSTALLER_FAILED"), - SMB_NTSTATUS_XML_ENCODING_MISMATCH => Some("STATUS_XML_ENCODING_MISMATCH"), - SMB_NTSTATUS_SXS_MANIFEST_TOO_BIG => Some("STATUS_SXS_MANIFEST_TOO_BIG"), - SMB_NTSTATUS_SXS_SETTING_NOT_REGISTERED => Some("STATUS_SXS_SETTING_NOT_REGISTERED"), - SMB_NTSTATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE => Some("STATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE"), - SMB_NTSTATUS_SMI_PRIMITIVE_INSTALLER_FAILED => Some("STATUS_SMI_PRIMITIVE_INSTALLER_FAILED"), - SMB_NTSTATUS_GENERIC_COMMAND_FAILED => Some("STATUS_GENERIC_COMMAND_FAILED"), - SMB_NTSTATUS_SXS_FILE_HASH_MISSING => Some("STATUS_SXS_FILE_HASH_MISSING"), - SMB_NTSTATUS_TRANSACTIONAL_CONFLICT => Some("STATUS_TRANSACTIONAL_CONFLICT"), - SMB_NTSTATUS_INVALID_TRANSACTION => Some("STATUS_INVALID_TRANSACTION"), - SMB_NTSTATUS_TRANSACTION_NOT_ACTIVE => Some("STATUS_TRANSACTION_NOT_ACTIVE"), - SMB_NTSTATUS_TM_INITIALIZATION_FAILED => Some("STATUS_TM_INITIALIZATION_FAILED"), - SMB_NTSTATUS_RM_NOT_ACTIVE => Some("STATUS_RM_NOT_ACTIVE"), - SMB_NTSTATUS_RM_METADATA_CORRUPT => Some("STATUS_RM_METADATA_CORRUPT"), - SMB_NTSTATUS_TRANSACTION_NOT_JOINED => Some("STATUS_TRANSACTION_NOT_JOINED"), - SMB_NTSTATUS_DIRECTORY_NOT_RM => Some("STATUS_DIRECTORY_NOT_RM"), - SMB_NTSTATUS_TRANSACTIONS_UNSUPPORTED_REMOTE => Some("STATUS_TRANSACTIONS_UNSUPPORTED_REMOTE"), - SMB_NTSTATUS_LOG_RESIZE_INVALID_SIZE => Some("STATUS_LOG_RESIZE_INVALID_SIZE"), - SMB_NTSTATUS_REMOTE_FILE_VERSION_MISMATCH => Some("STATUS_REMOTE_FILE_VERSION_MISMATCH"), - SMB_NTSTATUS_CRM_PROTOCOL_ALREADY_EXISTS => Some("STATUS_CRM_PROTOCOL_ALREADY_EXISTS"), - SMB_NTSTATUS_TRANSACTION_PROPAGATION_FAILED => Some("STATUS_TRANSACTION_PROPAGATION_FAILED"), - SMB_NTSTATUS_CRM_PROTOCOL_NOT_FOUND => Some("STATUS_CRM_PROTOCOL_NOT_FOUND"), - SMB_NTSTATUS_TRANSACTION_SUPERIOR_EXISTS => Some("STATUS_TRANSACTION_SUPERIOR_EXISTS"), - SMB_NTSTATUS_TRANSACTION_REQUEST_NOT_VALID => Some("STATUS_TRANSACTION_REQUEST_NOT_VALID"), - SMB_NTSTATUS_TRANSACTION_NOT_REQUESTED => Some("STATUS_TRANSACTION_NOT_REQUESTED"), - SMB_NTSTATUS_TRANSACTION_ALREADY_ABORTED => Some("STATUS_TRANSACTION_ALREADY_ABORTED"), - SMB_NTSTATUS_TRANSACTION_ALREADY_COMMITTED => Some("STATUS_TRANSACTION_ALREADY_COMMITTED"), - SMB_NTSTATUS_TRANSACTION_INVALID_MARSHALL_BUFFER => Some("STATUS_TRANSACTION_INVALID_MARSHALL_BUFFER"), - SMB_NTSTATUS_CURRENT_TRANSACTION_NOT_VALID => Some("STATUS_CURRENT_TRANSACTION_NOT_VALID"), - SMB_NTSTATUS_LOG_GROWTH_FAILED => Some("STATUS_LOG_GROWTH_FAILED"), - SMB_NTSTATUS_OBJECT_NO_LONGER_EXISTS => Some("STATUS_OBJECT_NO_LONGER_EXISTS"), - SMB_NTSTATUS_STREAM_MINIVERSION_NOT_FOUND => Some("STATUS_STREAM_MINIVERSION_NOT_FOUND"), - SMB_NTSTATUS_STREAM_MINIVERSION_NOT_VALID => Some("STATUS_STREAM_MINIVERSION_NOT_VALID"), - SMB_NTSTATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION => Some("STATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION"), - SMB_NTSTATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT => Some("STATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT"), - SMB_NTSTATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS => Some("STATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS"), - SMB_NTSTATUS_HANDLE_NO_LONGER_VALID => Some("STATUS_HANDLE_NO_LONGER_VALID"), - SMB_NTSTATUS_LOG_CORRUPTION_DETECTED => Some("STATUS_LOG_CORRUPTION_DETECTED"), - SMB_NTSTATUS_RM_DISCONNECTED => Some("STATUS_RM_DISCONNECTED"), - SMB_NTSTATUS_ENLISTMENT_NOT_SUPERIOR => Some("STATUS_ENLISTMENT_NOT_SUPERIOR"), - SMB_NTSTATUS_FILE_IDENTITY_NOT_PERSISTENT => Some("STATUS_FILE_IDENTITY_NOT_PERSISTENT"), - SMB_NTSTATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY => Some("STATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY"), - SMB_NTSTATUS_CANT_CROSS_RM_BOUNDARY => Some("STATUS_CANT_CROSS_RM_BOUNDARY"), - SMB_NTSTATUS_TXF_DIR_NOT_EMPTY => Some("STATUS_TXF_DIR_NOT_EMPTY"), - SMB_NTSTATUS_INDOUBT_TRANSACTIONS_EXIST => Some("STATUS_INDOUBT_TRANSACTIONS_EXIST"), - SMB_NTSTATUS_TM_VOLATILE => Some("STATUS_TM_VOLATILE"), - SMB_NTSTATUS_ROLLBACK_TIMER_EXPIRED => Some("STATUS_ROLLBACK_TIMER_EXPIRED"), - SMB_NTSTATUS_TXF_ATTRIBUTE_CORRUPT => Some("STATUS_TXF_ATTRIBUTE_CORRUPT"), - SMB_NTSTATUS_EFS_NOT_ALLOWED_IN_TRANSACTION => Some("STATUS_EFS_NOT_ALLOWED_IN_TRANSACTION"), - SMB_NTSTATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED => Some("STATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED"), - SMB_NTSTATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE => Some("STATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE"), - SMB_NTSTATUS_TRANSACTION_REQUIRED_PROMOTION => Some("STATUS_TRANSACTION_REQUIRED_PROMOTION"), - SMB_NTSTATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION => Some("STATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION"), - SMB_NTSTATUS_TRANSACTIONS_NOT_FROZEN => Some("STATUS_TRANSACTIONS_NOT_FROZEN"), - SMB_NTSTATUS_TRANSACTION_FREEZE_IN_PROGRESS => Some("STATUS_TRANSACTION_FREEZE_IN_PROGRESS"), - SMB_NTSTATUS_NOT_SNAPSHOT_VOLUME => Some("STATUS_NOT_SNAPSHOT_VOLUME"), - SMB_NTSTATUS_NO_SAVEPOINT_WITH_OPEN_FILES => Some("STATUS_NO_SAVEPOINT_WITH_OPEN_FILES"), - SMB_NTSTATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION => Some("STATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION"), - SMB_NTSTATUS_TM_IDENTITY_MISMATCH => Some("STATUS_TM_IDENTITY_MISMATCH"), - SMB_NTSTATUS_FLOATED_SECTION => Some("STATUS_FLOATED_SECTION"), - SMB_NTSTATUS_CANNOT_ACCEPT_TRANSACTED_WORK => Some("STATUS_CANNOT_ACCEPT_TRANSACTED_WORK"), - SMB_NTSTATUS_CANNOT_ABORT_TRANSACTIONS => Some("STATUS_CANNOT_ABORT_TRANSACTIONS"), - SMB_NTSTATUS_TRANSACTION_NOT_FOUND => Some("STATUS_TRANSACTION_NOT_FOUND"), - SMB_NTSTATUS_RESOURCEMANAGER_NOT_FOUND => Some("STATUS_RESOURCEMANAGER_NOT_FOUND"), - SMB_NTSTATUS_ENLISTMENT_NOT_FOUND => Some("STATUS_ENLISTMENT_NOT_FOUND"), - SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_FOUND => Some("STATUS_TRANSACTIONMANAGER_NOT_FOUND"), - SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_ONLINE => Some("STATUS_TRANSACTIONMANAGER_NOT_ONLINE"), - SMB_NTSTATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION => Some("STATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION"), - SMB_NTSTATUS_TRANSACTION_NOT_ROOT => Some("STATUS_TRANSACTION_NOT_ROOT"), - SMB_NTSTATUS_TRANSACTION_OBJECT_EXPIRED => Some("STATUS_TRANSACTION_OBJECT_EXPIRED"), - SMB_NTSTATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION => Some("STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION"), - SMB_NTSTATUS_TRANSACTION_RESPONSE_NOT_ENLISTED => Some("STATUS_TRANSACTION_RESPONSE_NOT_ENLISTED"), - SMB_NTSTATUS_TRANSACTION_RECORD_TOO_LONG => Some("STATUS_TRANSACTION_RECORD_TOO_LONG"), - SMB_NTSTATUS_NO_LINK_TRACKING_IN_TRANSACTION => Some("STATUS_NO_LINK_TRACKING_IN_TRANSACTION"), - SMB_NTSTATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION => Some("STATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION"), - SMB_NTSTATUS_TRANSACTION_INTEGRITY_VIOLATED => Some("STATUS_TRANSACTION_INTEGRITY_VIOLATED"), - SMB_NTSTATUS_EXPIRED_HANDLE => Some("STATUS_EXPIRED_HANDLE"), - SMB_NTSTATUS_TRANSACTION_NOT_ENLISTED => Some("STATUS_TRANSACTION_NOT_ENLISTED"), - SMB_NTSTATUS_LOG_SECTOR_INVALID => Some("STATUS_LOG_SECTOR_INVALID"), - SMB_NTSTATUS_LOG_SECTOR_PARITY_INVALID => Some("STATUS_LOG_SECTOR_PARITY_INVALID"), - SMB_NTSTATUS_LOG_SECTOR_REMAPPED => Some("STATUS_LOG_SECTOR_REMAPPED"), - SMB_NTSTATUS_LOG_BLOCK_INCOMPLETE => Some("STATUS_LOG_BLOCK_INCOMPLETE"), - SMB_NTSTATUS_LOG_INVALID_RANGE => Some("STATUS_LOG_INVALID_RANGE"), - SMB_NTSTATUS_LOG_BLOCKS_EXHAUSTED => Some("STATUS_LOG_BLOCKS_EXHAUSTED"), - SMB_NTSTATUS_LOG_READ_CONTEXT_INVALID => Some("STATUS_LOG_READ_CONTEXT_INVALID"), - SMB_NTSTATUS_LOG_RESTART_INVALID => Some("STATUS_LOG_RESTART_INVALID"), - SMB_NTSTATUS_LOG_BLOCK_VERSION => Some("STATUS_LOG_BLOCK_VERSION"), - SMB_NTSTATUS_LOG_BLOCK_INVALID => Some("STATUS_LOG_BLOCK_INVALID"), - SMB_NTSTATUS_LOG_READ_MODE_INVALID => Some("STATUS_LOG_READ_MODE_INVALID"), - SMB_NTSTATUS_LOG_METADATA_CORRUPT => Some("STATUS_LOG_METADATA_CORRUPT"), - SMB_NTSTATUS_LOG_METADATA_INVALID => Some("STATUS_LOG_METADATA_INVALID"), - SMB_NTSTATUS_LOG_METADATA_INCONSISTENT => Some("STATUS_LOG_METADATA_INCONSISTENT"), - SMB_NTSTATUS_LOG_RESERVATION_INVALID => Some("STATUS_LOG_RESERVATION_INVALID"), - SMB_NTSTATUS_LOG_CANT_DELETE => Some("STATUS_LOG_CANT_DELETE"), - SMB_NTSTATUS_LOG_CONTAINER_LIMIT_EXCEEDED => Some("STATUS_LOG_CONTAINER_LIMIT_EXCEEDED"), - SMB_NTSTATUS_LOG_START_OF_LOG => Some("STATUS_LOG_START_OF_LOG"), - SMB_NTSTATUS_LOG_POLICY_ALREADY_INSTALLED => Some("STATUS_LOG_POLICY_ALREADY_INSTALLED"), - SMB_NTSTATUS_LOG_POLICY_NOT_INSTALLED => Some("STATUS_LOG_POLICY_NOT_INSTALLED"), - SMB_NTSTATUS_LOG_POLICY_INVALID => Some("STATUS_LOG_POLICY_INVALID"), - SMB_NTSTATUS_LOG_POLICY_CONFLICT => Some("STATUS_LOG_POLICY_CONFLICT"), - SMB_NTSTATUS_LOG_PINNED_ARCHIVE_TAIL => Some("STATUS_LOG_PINNED_ARCHIVE_TAIL"), - SMB_NTSTATUS_LOG_RECORD_NONEXISTENT => Some("STATUS_LOG_RECORD_NONEXISTENT"), - SMB_NTSTATUS_LOG_RECORDS_RESERVED_INVALID => Some("STATUS_LOG_RECORDS_RESERVED_INVALID"), - SMB_NTSTATUS_LOG_SPACE_RESERVED_INVALID => Some("STATUS_LOG_SPACE_RESERVED_INVALID"), - SMB_NTSTATUS_LOG_TAIL_INVALID => Some("STATUS_LOG_TAIL_INVALID"), - SMB_NTSTATUS_LOG_FULL => Some("STATUS_LOG_FULL"), - SMB_NTSTATUS_LOG_MULTIPLEXED => Some("STATUS_LOG_MULTIPLEXED"), - SMB_NTSTATUS_LOG_DEDICATED => Some("STATUS_LOG_DEDICATED"), - SMB_NTSTATUS_LOG_ARCHIVE_NOT_IN_PROGRESS => Some("STATUS_LOG_ARCHIVE_NOT_IN_PROGRESS"), - SMB_NTSTATUS_LOG_ARCHIVE_IN_PROGRESS => Some("STATUS_LOG_ARCHIVE_IN_PROGRESS"), - SMB_NTSTATUS_LOG_EPHEMERAL => Some("STATUS_LOG_EPHEMERAL"), - SMB_NTSTATUS_LOG_NOT_ENOUGH_CONTAINERS => Some("STATUS_LOG_NOT_ENOUGH_CONTAINERS"), - SMB_NTSTATUS_LOG_CLIENT_ALREADY_REGISTERED => Some("STATUS_LOG_CLIENT_ALREADY_REGISTERED"), - SMB_NTSTATUS_LOG_CLIENT_NOT_REGISTERED => Some("STATUS_LOG_CLIENT_NOT_REGISTERED"), - SMB_NTSTATUS_LOG_FULL_HANDLER_IN_PROGRESS => Some("STATUS_LOG_FULL_HANDLER_IN_PROGRESS"), - SMB_NTSTATUS_LOG_CONTAINER_READ_FAILED => Some("STATUS_LOG_CONTAINER_READ_FAILED"), - SMB_NTSTATUS_LOG_CONTAINER_WRITE_FAILED => Some("STATUS_LOG_CONTAINER_WRITE_FAILED"), - SMB_NTSTATUS_LOG_CONTAINER_OPEN_FAILED => Some("STATUS_LOG_CONTAINER_OPEN_FAILED"), - SMB_NTSTATUS_LOG_CONTAINER_STATE_INVALID => Some("STATUS_LOG_CONTAINER_STATE_INVALID"), - SMB_NTSTATUS_LOG_STATE_INVALID => Some("STATUS_LOG_STATE_INVALID"), - SMB_NTSTATUS_LOG_PINNED => Some("STATUS_LOG_PINNED"), - SMB_NTSTATUS_LOG_METADATA_FLUSH_FAILED => Some("STATUS_LOG_METADATA_FLUSH_FAILED"), - SMB_NTSTATUS_LOG_INCONSISTENT_SECURITY => Some("STATUS_LOG_INCONSISTENT_SECURITY"), - SMB_NTSTATUS_LOG_APPENDED_FLUSH_FAILED => Some("STATUS_LOG_APPENDED_FLUSH_FAILED"), - SMB_NTSTATUS_LOG_PINNED_RESERVATION => Some("STATUS_LOG_PINNED_RESERVATION"), - SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD => Some("STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD"), - SMB_NTSTATUS_FLT_NO_HANDLER_DEFINED => Some("STATUS_FLT_NO_HANDLER_DEFINED"), - SMB_NTSTATUS_FLT_CONTEXT_ALREADY_DEFINED => Some("STATUS_FLT_CONTEXT_ALREADY_DEFINED"), - SMB_NTSTATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST => Some("STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST"), - SMB_NTSTATUS_FLT_DISALLOW_FAST_IO => Some("STATUS_FLT_DISALLOW_FAST_IO"), - SMB_NTSTATUS_FLT_INVALID_NAME_REQUEST => Some("STATUS_FLT_INVALID_NAME_REQUEST"), - SMB_NTSTATUS_FLT_NOT_SAFE_TO_POST_OPERATION => Some("STATUS_FLT_NOT_SAFE_TO_POST_OPERATION"), - SMB_NTSTATUS_FLT_NOT_INITIALIZED => Some("STATUS_FLT_NOT_INITIALIZED"), - SMB_NTSTATUS_FLT_FILTER_NOT_READY => Some("STATUS_FLT_FILTER_NOT_READY"), - SMB_NTSTATUS_FLT_POST_OPERATION_CLEANUP => Some("STATUS_FLT_POST_OPERATION_CLEANUP"), - SMB_NTSTATUS_FLT_INTERNAL_ERROR => Some("STATUS_FLT_INTERNAL_ERROR"), - SMB_NTSTATUS_FLT_DELETING_OBJECT => Some("STATUS_FLT_DELETING_OBJECT"), - SMB_NTSTATUS_FLT_MUST_BE_NONPAGED_POOL => Some("STATUS_FLT_MUST_BE_NONPAGED_POOL"), - SMB_NTSTATUS_FLT_DUPLICATE_ENTRY => Some("STATUS_FLT_DUPLICATE_ENTRY"), - SMB_NTSTATUS_FLT_CBDQ_DISABLED => Some("STATUS_FLT_CBDQ_DISABLED"), - SMB_NTSTATUS_FLT_DO_NOT_ATTACH => Some("STATUS_FLT_DO_NOT_ATTACH"), - SMB_NTSTATUS_FLT_DO_NOT_DETACH => Some("STATUS_FLT_DO_NOT_DETACH"), - SMB_NTSTATUS_FLT_INSTANCE_ALTITUDE_COLLISION => Some("STATUS_FLT_INSTANCE_ALTITUDE_COLLISION"), - SMB_NTSTATUS_FLT_INSTANCE_NAME_COLLISION => Some("STATUS_FLT_INSTANCE_NAME_COLLISION"), - SMB_NTSTATUS_FLT_FILTER_NOT_FOUND => Some("STATUS_FLT_FILTER_NOT_FOUND"), - SMB_NTSTATUS_FLT_VOLUME_NOT_FOUND => Some("STATUS_FLT_VOLUME_NOT_FOUND"), - SMB_NTSTATUS_FLT_INSTANCE_NOT_FOUND => Some("STATUS_FLT_INSTANCE_NOT_FOUND"), - SMB_NTSTATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND => Some("STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND"), - SMB_NTSTATUS_FLT_INVALID_CONTEXT_REGISTRATION => Some("STATUS_FLT_INVALID_CONTEXT_REGISTRATION"), - SMB_NTSTATUS_FLT_NAME_CACHE_MISS => Some("STATUS_FLT_NAME_CACHE_MISS"), - SMB_NTSTATUS_FLT_NO_DEVICE_OBJECT => Some("STATUS_FLT_NO_DEVICE_OBJECT"), - SMB_NTSTATUS_FLT_VOLUME_ALREADY_MOUNTED => Some("STATUS_FLT_VOLUME_ALREADY_MOUNTED"), - SMB_NTSTATUS_FLT_ALREADY_ENLISTED => Some("STATUS_FLT_ALREADY_ENLISTED"), - SMB_NTSTATUS_FLT_CONTEXT_ALREADY_LINKED => Some("STATUS_FLT_CONTEXT_ALREADY_LINKED"), - SMB_NTSTATUS_FLT_NO_WAITER_FOR_REPLY => Some("STATUS_FLT_NO_WAITER_FOR_REPLY"), - SMB_NTSTATUS_MONITOR_NO_DESCRIPTOR => Some("STATUS_MONITOR_NO_DESCRIPTOR"), - SMB_NTSTATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT => Some("STATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT"), - SMB_NTSTATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM => Some("STATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM"), - SMB_NTSTATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK => Some("STATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK"), - SMB_NTSTATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED => Some("STATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED"), - SMB_NTSTATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK => Some("STATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK"), - SMB_NTSTATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK => Some("STATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK"), - SMB_NTSTATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA => Some("STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA"), - SMB_NTSTATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK => Some("STATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK"), - SMB_NTSTATUS_MONITOR_INVALID_MANUFACTURE_DATE => Some("STATUS_MONITOR_INVALID_MANUFACTURE_DATE"), - SMB_NTSTATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER => Some("STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER"), - SMB_NTSTATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER => Some("STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER"), - SMB_NTSTATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER => Some("STATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER"), - SMB_NTSTATUS_GRAPHICS_ADAPTER_WAS_RESET => Some("STATUS_GRAPHICS_ADAPTER_WAS_RESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_DRIVER_MODEL => Some("STATUS_GRAPHICS_INVALID_DRIVER_MODEL"), - SMB_NTSTATUS_GRAPHICS_PRESENT_MODE_CHANGED => Some("STATUS_GRAPHICS_PRESENT_MODE_CHANGED"), - SMB_NTSTATUS_GRAPHICS_PRESENT_OCCLUDED => Some("STATUS_GRAPHICS_PRESENT_OCCLUDED"), - SMB_NTSTATUS_GRAPHICS_PRESENT_DENIED => Some("STATUS_GRAPHICS_PRESENT_DENIED"), - SMB_NTSTATUS_GRAPHICS_CANNOTCOLORCONVERT => Some("STATUS_GRAPHICS_CANNOTCOLORCONVERT"), - SMB_NTSTATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED => Some("STATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED"), - SMB_NTSTATUS_GRAPHICS_PRESENT_UNOCCLUDED => Some("STATUS_GRAPHICS_PRESENT_UNOCCLUDED"), - SMB_NTSTATUS_GRAPHICS_NO_VIDEO_MEMORY => Some("STATUS_GRAPHICS_NO_VIDEO_MEMORY"), - SMB_NTSTATUS_GRAPHICS_CANT_LOCK_MEMORY => Some("STATUS_GRAPHICS_CANT_LOCK_MEMORY"), - SMB_NTSTATUS_GRAPHICS_ALLOCATION_BUSY => Some("STATUS_GRAPHICS_ALLOCATION_BUSY"), - SMB_NTSTATUS_GRAPHICS_TOO_MANY_REFERENCES => Some("STATUS_GRAPHICS_TOO_MANY_REFERENCES"), - SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_LATER => Some("STATUS_GRAPHICS_TRY_AGAIN_LATER"), - SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_NOW => Some("STATUS_GRAPHICS_TRY_AGAIN_NOW"), - SMB_NTSTATUS_GRAPHICS_ALLOCATION_INVALID => Some("STATUS_GRAPHICS_ALLOCATION_INVALID"), - SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE => Some("STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE"), - SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED => Some("STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED"), - SMB_NTSTATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION => Some("STATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION"), - SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_USAGE => Some("STATUS_GRAPHICS_INVALID_ALLOCATION_USAGE"), - SMB_NTSTATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION => Some("STATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION"), - SMB_NTSTATUS_GRAPHICS_ALLOCATION_CLOSED => Some("STATUS_GRAPHICS_ALLOCATION_CLOSED"), - SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE => Some("STATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE"), - SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE => Some("STATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE"), - SMB_NTSTATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE => Some("STATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE"), - SMB_NTSTATUS_GRAPHICS_ALLOCATION_CONTENT_LOST => Some("STATUS_GRAPHICS_ALLOCATION_CONTENT_LOST"), - SMB_NTSTATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE => Some("STATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY => Some("STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY"), - SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED => Some("STATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED => Some("STATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN => Some("STATUS_GRAPHICS_INVALID_VIDPN"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE => Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET => Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET"), - SMB_NTSTATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED => Some("STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET => Some("STATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET => Some("STATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_FREQUENCY => Some("STATUS_GRAPHICS_INVALID_FREQUENCY"), - SMB_NTSTATUS_GRAPHICS_INVALID_ACTIVE_REGION => Some("STATUS_GRAPHICS_INVALID_ACTIVE_REGION"), - SMB_NTSTATUS_GRAPHICS_INVALID_TOTAL_REGION => Some("STATUS_GRAPHICS_INVALID_TOTAL_REGION"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE => Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE => Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE"), - SMB_NTSTATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET => Some("STATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET"), - SMB_NTSTATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY => Some("STATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY"), - SMB_NTSTATUS_GRAPHICS_MODE_ALREADY_IN_MODESET => Some("STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET => Some("STATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET => Some("STATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET"), - SMB_NTSTATUS_GRAPHICS_SOURCE_ALREADY_IN_SET => Some("STATUS_GRAPHICS_SOURCE_ALREADY_IN_SET"), - SMB_NTSTATUS_GRAPHICS_TARGET_ALREADY_IN_SET => Some("STATUS_GRAPHICS_TARGET_ALREADY_IN_SET"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH => Some("STATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH"), - SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY => Some("STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET => Some("STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE => Some("STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE"), - SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET => Some("STATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET"), - SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET => Some("STATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET"), - SMB_NTSTATUS_GRAPHICS_STALE_MODESET => Some("STATUS_GRAPHICS_STALE_MODESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET => Some("STATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE => Some("STATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE"), - SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN => Some("STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN"), - SMB_NTSTATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE => Some("STATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE"), - SMB_NTSTATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION => Some("STATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION"), - SMB_NTSTATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES => Some("STATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES"), - SMB_NTSTATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY => Some("STATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY"), - SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE => Some("STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE"), - SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET => Some("STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET => Some("STATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR => Some("STATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR"), - SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET => Some("STATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET"), - SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET => Some("STATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET"), - SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE => Some("STATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE => Some("STATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE"), - SMB_NTSTATUS_GRAPHICS_RESOURCES_NOT_RELATED => Some("STATUS_GRAPHICS_RESOURCES_NOT_RELATED"), - SMB_NTSTATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE => Some("STATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE"), - SMB_NTSTATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE => Some("STATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE"), - SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET => Some("STATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET"), - SMB_NTSTATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER => Some("STATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER"), - SMB_NTSTATUS_GRAPHICS_NO_VIDPNMGR => Some("STATUS_GRAPHICS_NO_VIDPNMGR"), - SMB_NTSTATUS_GRAPHICS_NO_ACTIVE_VIDPN => Some("STATUS_GRAPHICS_NO_ACTIVE_VIDPN"), - SMB_NTSTATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY => Some("STATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY"), - SMB_NTSTATUS_GRAPHICS_MONITOR_NOT_CONNECTED => Some("STATUS_GRAPHICS_MONITOR_NOT_CONNECTED"), - SMB_NTSTATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY => Some("STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY"), - SMB_NTSTATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE => Some("STATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE"), - SMB_NTSTATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE => Some("STATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE"), - SMB_NTSTATUS_GRAPHICS_INVALID_STRIDE => Some("STATUS_GRAPHICS_INVALID_STRIDE"), - SMB_NTSTATUS_GRAPHICS_INVALID_PIXELFORMAT => Some("STATUS_GRAPHICS_INVALID_PIXELFORMAT"), - SMB_NTSTATUS_GRAPHICS_INVALID_COLORBASIS => Some("STATUS_GRAPHICS_INVALID_COLORBASIS"), - SMB_NTSTATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE => Some("STATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE"), - SMB_NTSTATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY => Some("STATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY"), - SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT => Some("STATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT"), - SMB_NTSTATUS_GRAPHICS_VIDPN_SOURCE_IN_USE => Some("STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE"), - SMB_NTSTATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN => Some("STATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN"), - SMB_NTSTATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL => Some("STATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL"), - SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION => Some("STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION"), - SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED => Some("STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_INVALID_GAMMA_RAMP => Some("STATUS_GRAPHICS_INVALID_GAMMA_RAMP"), - SMB_NTSTATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED => Some("STATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED => Some("STATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_MODE_NOT_IN_MODESET => Some("STATUS_GRAPHICS_MODE_NOT_IN_MODESET"), - SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON => Some("STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON"), - SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE => Some("STATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE"), - SMB_NTSTATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE => Some("STATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE"), - SMB_NTSTATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS => Some("STATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS"), - SMB_NTSTATUS_GRAPHICS_INVALID_SCANLINE_ORDERING => Some("STATUS_GRAPHICS_INVALID_SCANLINE_ORDERING"), - SMB_NTSTATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED => Some("STATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED"), - SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS => Some("STATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS"), - SMB_NTSTATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT => Some("STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT"), - SMB_NTSTATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM => Some("STATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN => Some("STATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN"), - SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT => Some("STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT"), - SMB_NTSTATUS_GRAPHICS_MAX_NUM_PATHS_REACHED => Some("STATUS_GRAPHICS_MAX_NUM_PATHS_REACHED"), - SMB_NTSTATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION => Some("STATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION"), - SMB_NTSTATUS_GRAPHICS_INVALID_CLIENT_TYPE => Some("STATUS_GRAPHICS_INVALID_CLIENT_TYPE"), - SMB_NTSTATUS_GRAPHICS_CLIENTVIDPN_NOT_SET => Some("STATUS_GRAPHICS_CLIENTVIDPN_NOT_SET"), - SMB_NTSTATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED => Some("STATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED"), - SMB_NTSTATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED => Some("STATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_NOT_A_LINKED_ADAPTER => Some("STATUS_GRAPHICS_NOT_A_LINKED_ADAPTER"), - SMB_NTSTATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED => Some("STATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED"), - SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED => Some("STATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED"), - SMB_NTSTATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY => Some("STATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY"), - SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_STARTED => Some("STATUS_GRAPHICS_CHAINLINKS_NOT_STARTED"), - SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON => Some("STATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON"), - SMB_NTSTATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE => Some("STATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE"), - SMB_NTSTATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER => Some("STATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER"), - SMB_NTSTATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED => Some("STATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED"), - SMB_NTSTATUS_GRAPHICS_OPM_NOT_SUPPORTED => Some("STATUS_GRAPHICS_OPM_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_COPP_NOT_SUPPORTED => Some("STATUS_GRAPHICS_COPP_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_UAB_NOT_SUPPORTED => Some("STATUS_GRAPHICS_UAB_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS => Some("STATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS"), - SMB_NTSTATUS_GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL => Some("STATUS_GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL"), - SMB_NTSTATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST => Some("STATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST"), - SMB_NTSTATUS_GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME => Some("STATUS_GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME"), - SMB_NTSTATUS_GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP => Some("STATUS_GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP"), - SMB_NTSTATUS_GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED => Some("STATUS_GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_OPM_INVALID_POINTER => Some("STATUS_GRAPHICS_OPM_INVALID_POINTER"), - SMB_NTSTATUS_GRAPHICS_OPM_INTERNAL_ERROR => Some("STATUS_GRAPHICS_OPM_INTERNAL_ERROR"), - SMB_NTSTATUS_GRAPHICS_OPM_INVALID_HANDLE => Some("STATUS_GRAPHICS_OPM_INVALID_HANDLE"), - SMB_NTSTATUS_GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE => Some("STATUS_GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE"), - SMB_NTSTATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH => Some("STATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH"), - SMB_NTSTATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED => Some("STATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED"), - SMB_NTSTATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED => Some("STATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED"), - SMB_NTSTATUS_GRAPHICS_PVP_HFS_FAILED => Some("STATUS_GRAPHICS_PVP_HFS_FAILED"), - SMB_NTSTATUS_GRAPHICS_OPM_INVALID_SRM => Some("STATUS_GRAPHICS_OPM_INVALID_SRM"), - SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP => Some("STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP"), - SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP => Some("STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP"), - SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA => Some("STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA"), - SMB_NTSTATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET => Some("STATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET"), - SMB_NTSTATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH => Some("STATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH"), - SMB_NTSTATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE => Some("STATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE"), - SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS => Some("STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS"), - SMB_NTSTATUS_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS => Some("STATUS_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS"), - SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS => Some("STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS"), - SMB_NTSTATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST => Some("STATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST"), - SMB_NTSTATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR => Some("STATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR"), - SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS => Some("STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS"), - SMB_NTSTATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED => Some("STATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST => Some("STATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST"), - SMB_NTSTATUS_GRAPHICS_I2C_NOT_SUPPORTED => Some("STATUS_GRAPHICS_I2C_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST => Some("STATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST"), - SMB_NTSTATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA => Some("STATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA"), - SMB_NTSTATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA => Some("STATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA"), - SMB_NTSTATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED => Some("STATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_DATA => Some("STATUS_GRAPHICS_DDCCI_INVALID_DATA"), - SMB_NTSTATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE => Some("STATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE"), - SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING => Some("STATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING"), - SMB_NTSTATUS_GRAPHICS_MCA_INTERNAL_ERROR => Some("STATUS_GRAPHICS_MCA_INTERNAL_ERROR"), - SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND => Some("STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND"), - SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH => Some("STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH"), - SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM => Some("STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM"), - SMB_NTSTATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE => Some("STATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE"), - SMB_NTSTATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS => Some("STATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS"), - SMB_NTSTATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED => Some("STATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME => Some("STATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME"), - SMB_NTSTATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP => Some("STATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP"), - SMB_NTSTATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED => Some("STATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED"), - SMB_NTSTATUS_GRAPHICS_INVALID_POINTER => Some("STATUS_GRAPHICS_INVALID_POINTER"), - SMB_NTSTATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE => Some("STATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE"), - SMB_NTSTATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL => Some("STATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL"), - SMB_NTSTATUS_GRAPHICS_INTERNAL_ERROR => Some("STATUS_GRAPHICS_INTERNAL_ERROR"), - SMB_NTSTATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS => Some("STATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS"), - SMB_NTSTATUS_FVE_LOCKED_VOLUME => Some("STATUS_FVE_LOCKED_VOLUME"), - SMB_NTSTATUS_FVE_NOT_ENCRYPTED => Some("STATUS_FVE_NOT_ENCRYPTED"), - SMB_NTSTATUS_FVE_BAD_INFORMATION => Some("STATUS_FVE_BAD_INFORMATION"), - SMB_NTSTATUS_FVE_TOO_SMALL => Some("STATUS_FVE_TOO_SMALL"), - SMB_NTSTATUS_FVE_FAILED_WRONG_FS => Some("STATUS_FVE_FAILED_WRONG_FS"), - SMB_NTSTATUS_FVE_FAILED_BAD_FS => Some("STATUS_FVE_FAILED_BAD_FS"), - SMB_NTSTATUS_FVE_FS_NOT_EXTENDED => Some("STATUS_FVE_FS_NOT_EXTENDED"), - SMB_NTSTATUS_FVE_FS_MOUNTED => Some("STATUS_FVE_FS_MOUNTED"), - SMB_NTSTATUS_FVE_NO_LICENSE => Some("STATUS_FVE_NO_LICENSE"), - SMB_NTSTATUS_FVE_ACTION_NOT_ALLOWED => Some("STATUS_FVE_ACTION_NOT_ALLOWED"), - SMB_NTSTATUS_FVE_BAD_DATA => Some("STATUS_FVE_BAD_DATA"), - SMB_NTSTATUS_FVE_VOLUME_NOT_BOUND => Some("STATUS_FVE_VOLUME_NOT_BOUND"), - SMB_NTSTATUS_FVE_NOT_DATA_VOLUME => Some("STATUS_FVE_NOT_DATA_VOLUME"), - SMB_NTSTATUS_FVE_CONV_READ_ERROR => Some("STATUS_FVE_CONV_READ_ERROR"), - SMB_NTSTATUS_FVE_CONV_WRITE_ERROR => Some("STATUS_FVE_CONV_WRITE_ERROR"), - SMB_NTSTATUS_FVE_OVERLAPPED_UPDATE => Some("STATUS_FVE_OVERLAPPED_UPDATE"), - SMB_NTSTATUS_FVE_FAILED_SECTOR_SIZE => Some("STATUS_FVE_FAILED_SECTOR_SIZE"), - SMB_NTSTATUS_FVE_FAILED_AUTHENTICATION => Some("STATUS_FVE_FAILED_AUTHENTICATION"), - SMB_NTSTATUS_FVE_NOT_OS_VOLUME => Some("STATUS_FVE_NOT_OS_VOLUME"), - SMB_NTSTATUS_FVE_KEYFILE_NOT_FOUND => Some("STATUS_FVE_KEYFILE_NOT_FOUND"), - SMB_NTSTATUS_FVE_KEYFILE_INVALID => Some("STATUS_FVE_KEYFILE_INVALID"), - SMB_NTSTATUS_FVE_KEYFILE_NO_VMK => Some("STATUS_FVE_KEYFILE_NO_VMK"), - SMB_NTSTATUS_FVE_TPM_DISABLED => Some("STATUS_FVE_TPM_DISABLED"), - SMB_NTSTATUS_FVE_TPM_SRK_AUTH_NOT_ZERO => Some("STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO"), - SMB_NTSTATUS_FVE_TPM_INVALID_PCR => Some("STATUS_FVE_TPM_INVALID_PCR"), - SMB_NTSTATUS_FVE_TPM_NO_VMK => Some("STATUS_FVE_TPM_NO_VMK"), - SMB_NTSTATUS_FVE_PIN_INVALID => Some("STATUS_FVE_PIN_INVALID"), - SMB_NTSTATUS_FVE_AUTH_INVALID_APPLICATION => Some("STATUS_FVE_AUTH_INVALID_APPLICATION"), - SMB_NTSTATUS_FVE_AUTH_INVALID_CONFIG => Some("STATUS_FVE_AUTH_INVALID_CONFIG"), - SMB_NTSTATUS_FVE_DEBUGGER_ENABLED => Some("STATUS_FVE_DEBUGGER_ENABLED"), - SMB_NTSTATUS_FVE_DRY_RUN_FAILED => Some("STATUS_FVE_DRY_RUN_FAILED"), - SMB_NTSTATUS_FVE_BAD_METADATA_POINTER => Some("STATUS_FVE_BAD_METADATA_POINTER"), - SMB_NTSTATUS_FVE_OLD_METADATA_COPY => Some("STATUS_FVE_OLD_METADATA_COPY"), - SMB_NTSTATUS_FVE_REBOOT_REQUIRED => Some("STATUS_FVE_REBOOT_REQUIRED"), - SMB_NTSTATUS_FVE_RAW_ACCESS => Some("STATUS_FVE_RAW_ACCESS"), - SMB_NTSTATUS_FVE_RAW_BLOCKED => Some("STATUS_FVE_RAW_BLOCKED"), - SMB_NTSTATUS_FVE_NO_FEATURE_LICENSE => Some("STATUS_FVE_NO_FEATURE_LICENSE"), - SMB_NTSTATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED => Some("STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED"), - SMB_NTSTATUS_FVE_CONV_RECOVERY_FAILED => Some("STATUS_FVE_CONV_RECOVERY_FAILED"), - SMB_NTSTATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG => Some("STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG"), - SMB_NTSTATUS_FVE_VOLUME_TOO_SMALL => Some("STATUS_FVE_VOLUME_TOO_SMALL"), - SMB_NTSTATUS_FWP_CALLOUT_NOT_FOUND => Some("STATUS_FWP_CALLOUT_NOT_FOUND"), - SMB_NTSTATUS_FWP_CONDITION_NOT_FOUND => Some("STATUS_FWP_CONDITION_NOT_FOUND"), - SMB_NTSTATUS_FWP_FILTER_NOT_FOUND => Some("STATUS_FWP_FILTER_NOT_FOUND"), - SMB_NTSTATUS_FWP_LAYER_NOT_FOUND => Some("STATUS_FWP_LAYER_NOT_FOUND"), - SMB_NTSTATUS_FWP_PROVIDER_NOT_FOUND => Some("STATUS_FWP_PROVIDER_NOT_FOUND"), - SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND => Some("STATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND"), - SMB_NTSTATUS_FWP_SUBLAYER_NOT_FOUND => Some("STATUS_FWP_SUBLAYER_NOT_FOUND"), - SMB_NTSTATUS_FWP_NOT_FOUND => Some("STATUS_FWP_NOT_FOUND"), - SMB_NTSTATUS_FWP_ALREADY_EXISTS => Some("STATUS_FWP_ALREADY_EXISTS"), - SMB_NTSTATUS_FWP_IN_USE => Some("STATUS_FWP_IN_USE"), - SMB_NTSTATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS => Some("STATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS"), - SMB_NTSTATUS_FWP_WRONG_SESSION => Some("STATUS_FWP_WRONG_SESSION"), - SMB_NTSTATUS_FWP_NO_TXN_IN_PROGRESS => Some("STATUS_FWP_NO_TXN_IN_PROGRESS"), - SMB_NTSTATUS_FWP_TXN_IN_PROGRESS => Some("STATUS_FWP_TXN_IN_PROGRESS"), - SMB_NTSTATUS_FWP_TXN_ABORTED => Some("STATUS_FWP_TXN_ABORTED"), - SMB_NTSTATUS_FWP_SESSION_ABORTED => Some("STATUS_FWP_SESSION_ABORTED"), - SMB_NTSTATUS_FWP_INCOMPATIBLE_TXN => Some("STATUS_FWP_INCOMPATIBLE_TXN"), - SMB_NTSTATUS_FWP_TIMEOUT => Some("STATUS_FWP_TIMEOUT"), - SMB_NTSTATUS_FWP_NET_EVENTS_DISABLED => Some("STATUS_FWP_NET_EVENTS_DISABLED"), - SMB_NTSTATUS_FWP_INCOMPATIBLE_LAYER => Some("STATUS_FWP_INCOMPATIBLE_LAYER"), - SMB_NTSTATUS_FWP_KM_CLIENTS_ONLY => Some("STATUS_FWP_KM_CLIENTS_ONLY"), - SMB_NTSTATUS_FWP_LIFETIME_MISMATCH => Some("STATUS_FWP_LIFETIME_MISMATCH"), - SMB_NTSTATUS_FWP_BUILTIN_OBJECT => Some("STATUS_FWP_BUILTIN_OBJECT"), - SMB_NTSTATUS_FWP_TOO_MANY_BOOTTIME_FILTERS => Some("STATUS_FWP_TOO_MANY_BOOTTIME_FILTERS"), - SMB_NTSTATUS_FWP_NOTIFICATION_DROPPED => Some("STATUS_FWP_NOTIFICATION_DROPPED"), - SMB_NTSTATUS_FWP_TRAFFIC_MISMATCH => Some("STATUS_FWP_TRAFFIC_MISMATCH"), - SMB_NTSTATUS_FWP_INCOMPATIBLE_SA_STATE => Some("STATUS_FWP_INCOMPATIBLE_SA_STATE"), - SMB_NTSTATUS_FWP_NULL_POINTER => Some("STATUS_FWP_NULL_POINTER"), - SMB_NTSTATUS_FWP_INVALID_ENUMERATOR => Some("STATUS_FWP_INVALID_ENUMERATOR"), - SMB_NTSTATUS_FWP_INVALID_FLAGS => Some("STATUS_FWP_INVALID_FLAGS"), - SMB_NTSTATUS_FWP_INVALID_NET_MASK => Some("STATUS_FWP_INVALID_NET_MASK"), - SMB_NTSTATUS_FWP_INVALID_RANGE => Some("STATUS_FWP_INVALID_RANGE"), - SMB_NTSTATUS_FWP_INVALID_INTERVAL => Some("STATUS_FWP_INVALID_INTERVAL"), - SMB_NTSTATUS_FWP_ZERO_LENGTH_ARRAY => Some("STATUS_FWP_ZERO_LENGTH_ARRAY"), - SMB_NTSTATUS_FWP_NULL_DISPLAY_NAME => Some("STATUS_FWP_NULL_DISPLAY_NAME"), - SMB_NTSTATUS_FWP_INVALID_ACTION_TYPE => Some("STATUS_FWP_INVALID_ACTION_TYPE"), - SMB_NTSTATUS_FWP_INVALID_WEIGHT => Some("STATUS_FWP_INVALID_WEIGHT"), - SMB_NTSTATUS_FWP_MATCH_TYPE_MISMATCH => Some("STATUS_FWP_MATCH_TYPE_MISMATCH"), - SMB_NTSTATUS_FWP_TYPE_MISMATCH => Some("STATUS_FWP_TYPE_MISMATCH"), - SMB_NTSTATUS_FWP_OUT_OF_BOUNDS => Some("STATUS_FWP_OUT_OF_BOUNDS"), - SMB_NTSTATUS_FWP_RESERVED => Some("STATUS_FWP_RESERVED"), - SMB_NTSTATUS_FWP_DUPLICATE_CONDITION => Some("STATUS_FWP_DUPLICATE_CONDITION"), - SMB_NTSTATUS_FWP_DUPLICATE_KEYMOD => Some("STATUS_FWP_DUPLICATE_KEYMOD"), - SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER => Some("STATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER"), - SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER => Some("STATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER"), - SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER => Some("STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER"), - SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT => Some("STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT"), - SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_METHOD => Some("STATUS_FWP_INCOMPATIBLE_AUTH_METHOD"), - SMB_NTSTATUS_FWP_INCOMPATIBLE_DH_GROUP => Some("STATUS_FWP_INCOMPATIBLE_DH_GROUP"), - SMB_NTSTATUS_FWP_EM_NOT_SUPPORTED => Some("STATUS_FWP_EM_NOT_SUPPORTED"), - SMB_NTSTATUS_FWP_NEVER_MATCH => Some("STATUS_FWP_NEVER_MATCH"), - SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_MISMATCH => Some("STATUS_FWP_PROVIDER_CONTEXT_MISMATCH"), - SMB_NTSTATUS_FWP_INVALID_PARAMETER => Some("STATUS_FWP_INVALID_PARAMETER"), - SMB_NTSTATUS_FWP_TOO_MANY_SUBLAYERS => Some("STATUS_FWP_TOO_MANY_SUBLAYERS"), - SMB_NTSTATUS_FWP_CALLOUT_NOTIFICATION_FAILED => Some("STATUS_FWP_CALLOUT_NOTIFICATION_FAILED"), - SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_CONFIG => Some("STATUS_FWP_INCOMPATIBLE_AUTH_CONFIG"), - SMB_NTSTATUS_FWP_INCOMPATIBLE_CIPHER_CONFIG => Some("STATUS_FWP_INCOMPATIBLE_CIPHER_CONFIG"), - SMB_NTSTATUS_FWP_DUPLICATE_AUTH_METHOD => Some("STATUS_FWP_DUPLICATE_AUTH_METHOD"), - SMB_NTSTATUS_FWP_TCPIP_NOT_READY => Some("STATUS_FWP_TCPIP_NOT_READY"), - SMB_NTSTATUS_FWP_INJECT_HANDLE_CLOSING => Some("STATUS_FWP_INJECT_HANDLE_CLOSING"), - SMB_NTSTATUS_FWP_INJECT_HANDLE_STALE => Some("STATUS_FWP_INJECT_HANDLE_STALE"), - SMB_NTSTATUS_FWP_CANNOT_PEND => Some("STATUS_FWP_CANNOT_PEND"), - SMB_NTSTATUS_NDIS_CLOSING => Some("STATUS_NDIS_CLOSING"), - SMB_NTSTATUS_NDIS_BAD_VERSION => Some("STATUS_NDIS_BAD_VERSION"), - SMB_NTSTATUS_NDIS_BAD_CHARACTERISTICS => Some("STATUS_NDIS_BAD_CHARACTERISTICS"), - SMB_NTSTATUS_NDIS_ADAPTER_NOT_FOUND => Some("STATUS_NDIS_ADAPTER_NOT_FOUND"), - SMB_NTSTATUS_NDIS_OPEN_FAILED => Some("STATUS_NDIS_OPEN_FAILED"), - SMB_NTSTATUS_NDIS_DEVICE_FAILED => Some("STATUS_NDIS_DEVICE_FAILED"), - SMB_NTSTATUS_NDIS_MULTICAST_FULL => Some("STATUS_NDIS_MULTICAST_FULL"), - SMB_NTSTATUS_NDIS_MULTICAST_EXISTS => Some("STATUS_NDIS_MULTICAST_EXISTS"), - SMB_NTSTATUS_NDIS_MULTICAST_NOT_FOUND => Some("STATUS_NDIS_MULTICAST_NOT_FOUND"), - SMB_NTSTATUS_NDIS_REQUEST_ABORTED => Some("STATUS_NDIS_REQUEST_ABORTED"), - SMB_NTSTATUS_NDIS_RESET_IN_PROGRESS => Some("STATUS_NDIS_RESET_IN_PROGRESS"), - SMB_NTSTATUS_NDIS_INVALID_PACKET => Some("STATUS_NDIS_INVALID_PACKET"), - SMB_NTSTATUS_NDIS_INVALID_DEVICE_REQUEST => Some("STATUS_NDIS_INVALID_DEVICE_REQUEST"), - SMB_NTSTATUS_NDIS_ADAPTER_NOT_READY => Some("STATUS_NDIS_ADAPTER_NOT_READY"), - SMB_NTSTATUS_NDIS_INVALID_LENGTH => Some("STATUS_NDIS_INVALID_LENGTH"), - SMB_NTSTATUS_NDIS_INVALID_DATA => Some("STATUS_NDIS_INVALID_DATA"), - SMB_NTSTATUS_NDIS_BUFFER_TOO_SHORT => Some("STATUS_NDIS_BUFFER_TOO_SHORT"), - SMB_NTSTATUS_NDIS_INVALID_OID => Some("STATUS_NDIS_INVALID_OID"), - SMB_NTSTATUS_NDIS_ADAPTER_REMOVED => Some("STATUS_NDIS_ADAPTER_REMOVED"), - SMB_NTSTATUS_NDIS_UNSUPPORTED_MEDIA => Some("STATUS_NDIS_UNSUPPORTED_MEDIA"), - SMB_NTSTATUS_NDIS_GROUP_ADDRESS_IN_USE => Some("STATUS_NDIS_GROUP_ADDRESS_IN_USE"), - SMB_NTSTATUS_NDIS_FILE_NOT_FOUND => Some("STATUS_NDIS_FILE_NOT_FOUND"), - SMB_NTSTATUS_NDIS_ERROR_READING_FILE => Some("STATUS_NDIS_ERROR_READING_FILE"), - SMB_NTSTATUS_NDIS_ALREADY_MAPPED => Some("STATUS_NDIS_ALREADY_MAPPED"), - SMB_NTSTATUS_NDIS_RESOURCE_CONFLICT => Some("STATUS_NDIS_RESOURCE_CONFLICT"), - SMB_NTSTATUS_NDIS_MEDIA_DISCONNECTED => Some("STATUS_NDIS_MEDIA_DISCONNECTED"), - SMB_NTSTATUS_NDIS_INVALID_ADDRESS => Some("STATUS_NDIS_INVALID_ADDRESS"), - SMB_NTSTATUS_NDIS_PAUSED => Some("STATUS_NDIS_PAUSED"), - SMB_NTSTATUS_NDIS_INTERFACE_NOT_FOUND => Some("STATUS_NDIS_INTERFACE_NOT_FOUND"), - SMB_NTSTATUS_NDIS_UNSUPPORTED_REVISION => Some("STATUS_NDIS_UNSUPPORTED_REVISION"), - SMB_NTSTATUS_NDIS_INVALID_PORT => Some("STATUS_NDIS_INVALID_PORT"), - SMB_NTSTATUS_NDIS_INVALID_PORT_STATE => Some("STATUS_NDIS_INVALID_PORT_STATE"), - SMB_NTSTATUS_NDIS_LOW_POWER_STATE => Some("STATUS_NDIS_LOW_POWER_STATE"), - SMB_NTSTATUS_NDIS_NOT_SUPPORTED => Some("STATUS_NDIS_NOT_SUPPORTED"), - SMB_NTSTATUS_NDIS_OFFLOAD_POLICY => Some("STATUS_NDIS_OFFLOAD_POLICY"), - SMB_NTSTATUS_NDIS_OFFLOAD_CONNECTION_REJECTED => Some("STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED"), - SMB_NTSTATUS_NDIS_OFFLOAD_PATH_REJECTED => Some("STATUS_NDIS_OFFLOAD_PATH_REJECTED"), - SMB_NTSTATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED => Some("STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED"), - SMB_NTSTATUS_NDIS_DOT11_MEDIA_IN_USE => Some("STATUS_NDIS_DOT11_MEDIA_IN_USE"), - SMB_NTSTATUS_NDIS_DOT11_POWER_STATE_INVALID => Some("STATUS_NDIS_DOT11_POWER_STATE_INVALID"), - SMB_NTSTATUS_NDIS_PM_WOL_PATTERN_LIST_FULL => Some("STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL"), - SMB_NTSTATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL => Some("STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL"), - SMB_NTSTATUS_IPSEC_BAD_SPI => Some("STATUS_IPSEC_BAD_SPI"), - SMB_NTSTATUS_IPSEC_SA_LIFETIME_EXPIRED => Some("STATUS_IPSEC_SA_LIFETIME_EXPIRED"), - SMB_NTSTATUS_IPSEC_WRONG_SA => Some("STATUS_IPSEC_WRONG_SA"), - SMB_NTSTATUS_IPSEC_REPLAY_CHECK_FAILED => Some("STATUS_IPSEC_REPLAY_CHECK_FAILED"), - SMB_NTSTATUS_IPSEC_INVALID_PACKET => Some("STATUS_IPSEC_INVALID_PACKET"), - SMB_NTSTATUS_IPSEC_INTEGRITY_CHECK_FAILED => Some("STATUS_IPSEC_INTEGRITY_CHECK_FAILED"), - SMB_NTSTATUS_IPSEC_CLEAR_TEXT_DROP => Some("STATUS_IPSEC_CLEAR_TEXT_DROP"), - SMB_NTSTATUS_IPSEC_AUTH_FIREWALL_DROP => Some("STATUS_IPSEC_AUTH_FIREWALL_DROP"), - SMB_NTSTATUS_IPSEC_THROTTLE_DROP => Some("STATUS_IPSEC_THROTTLE_DROP"), - SMB_NTSTATUS_IPSEC_DOSP_BLOCK => Some("STATUS_IPSEC_DOSP_BLOCK"), - SMB_NTSTATUS_IPSEC_DOSP_RECEIVED_MULTICAST => Some("STATUS_IPSEC_DOSP_RECEIVED_MULTICAST"), - SMB_NTSTATUS_IPSEC_DOSP_INVALID_PACKET => Some("STATUS_IPSEC_DOSP_INVALID_PACKET"), - SMB_NTSTATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED => Some("STATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED"), - SMB_NTSTATUS_IPSEC_DOSP_MAX_ENTRIES => Some("STATUS_IPSEC_DOSP_MAX_ENTRIES"), - SMB_NTSTATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED => Some("STATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED"), - SMB_NTSTATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES => Some("STATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES"), - SMB_NTSTATUS_VOLMGR_MIRROR_NOT_SUPPORTED => Some("STATUS_VOLMGR_MIRROR_NOT_SUPPORTED"), - SMB_NTSTATUS_VOLMGR_RAID5_NOT_SUPPORTED => Some("STATUS_VOLMGR_RAID5_NOT_SUPPORTED"), - SMB_NTSTATUS_VIRTDISK_PROVIDER_NOT_FOUND => Some("STATUS_VIRTDISK_PROVIDER_NOT_FOUND"), - SMB_NTSTATUS_VIRTDISK_NOT_VIRTUAL_DISK => Some("STATUS_VIRTDISK_NOT_VIRTUAL_DISK"), - SMB_NTSTATUS_VHD_PARENT_VHD_ACCESS_DENIED => Some("STATUS_VHD_PARENT_VHD_ACCESS_DENIED"), - SMB_NTSTATUS_VHD_CHILD_PARENT_SIZE_MISMATCH => Some("STATUS_VHD_CHILD_PARENT_SIZE_MISMATCH"), - SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED => Some("STATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED"), - SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT => Some("STATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT"), - + SMB_NTSTATUS_SUCCESS => Some("STATUS_SUCCESS"), + SMB_NTSTATUS_WAIT_1 => Some("STATUS_WAIT_1"), + SMB_NTSTATUS_WAIT_2 => Some("STATUS_WAIT_2"), + SMB_NTSTATUS_WAIT_3 => Some("STATUS_WAIT_3"), + SMB_NTSTATUS_WAIT_63 => Some("STATUS_WAIT_63"), + SMB_NTSTATUS_ABANDONED => Some("STATUS_ABANDONED"), + SMB_NTSTATUS_ABANDONED_WAIT_63 => Some("STATUS_ABANDONED_WAIT_63"), + SMB_NTSTATUS_USER_APC => Some("STATUS_USER_APC"), + SMB_NTSTATUS_ALERTED => Some("STATUS_ALERTED"), + SMB_NTSTATUS_TIMEOUT => Some("STATUS_TIMEOUT"), + SMB_NTSTATUS_PENDING => Some("STATUS_PENDING"), + SMB_NTSTATUS_REPARSE => Some("STATUS_REPARSE"), + SMB_NTSTATUS_MORE_ENTRIES => Some("STATUS_MORE_ENTRIES"), + SMB_NTSTATUS_NOT_ALL_ASSIGNED => Some("STATUS_NOT_ALL_ASSIGNED"), + SMB_NTSTATUS_SOME_NOT_MAPPED => Some("STATUS_SOME_NOT_MAPPED"), + SMB_NTSTATUS_OPLOCK_BREAK_IN_PROGRESS => Some("STATUS_OPLOCK_BREAK_IN_PROGRESS"), + SMB_NTSTATUS_VOLUME_MOUNTED => Some("STATUS_VOLUME_MOUNTED"), + SMB_NTSTATUS_RXACT_COMMITTED => Some("STATUS_RXACT_COMMITTED"), + SMB_NTSTATUS_NOTIFY_CLEANUP => Some("STATUS_NOTIFY_CLEANUP"), + SMB_NTSTATUS_NOTIFY_ENUM_DIR => Some("STATUS_NOTIFY_ENUM_DIR"), + SMB_NTSTATUS_NO_QUOTAS_FOR_ACCOUNT => Some("STATUS_NO_QUOTAS_FOR_ACCOUNT"), + SMB_NTSTATUS_PRIMARY_TRANSPORT_CONNECT_FAILED => { + Some("STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED") + } + SMB_NTSTATUS_PAGE_FAULT_TRANSITION => Some("STATUS_PAGE_FAULT_TRANSITION"), + SMB_NTSTATUS_PAGE_FAULT_DEMAND_ZERO => Some("STATUS_PAGE_FAULT_DEMAND_ZERO"), + SMB_NTSTATUS_PAGE_FAULT_COPY_ON_WRITE => Some("STATUS_PAGE_FAULT_COPY_ON_WRITE"), + SMB_NTSTATUS_PAGE_FAULT_GUARD_PAGE => Some("STATUS_PAGE_FAULT_GUARD_PAGE"), + SMB_NTSTATUS_PAGE_FAULT_PAGING_FILE => Some("STATUS_PAGE_FAULT_PAGING_FILE"), + SMB_NTSTATUS_CACHE_PAGE_LOCKED => Some("STATUS_CACHE_PAGE_LOCKED"), + SMB_NTSTATUS_CRASH_DUMP => Some("STATUS_CRASH_DUMP"), + SMB_NTSTATUS_BUFFER_ALL_ZEROS => Some("STATUS_BUFFER_ALL_ZEROS"), + SMB_NTSTATUS_REPARSE_OBJECT => Some("STATUS_REPARSE_OBJECT"), + SMB_NTSTATUS_RESOURCE_REQUIREMENTS_CHANGED => Some("STATUS_RESOURCE_REQUIREMENTS_CHANGED"), + SMB_NTSTATUS_TRANSLATION_COMPLETE => Some("STATUS_TRANSLATION_COMPLETE"), + SMB_NTSTATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY => { + Some("STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY") + } + SMB_NTSTATUS_NOTHING_TO_TERMINATE => Some("STATUS_NOTHING_TO_TERMINATE"), + SMB_NTSTATUS_PROCESS_NOT_IN_JOB => Some("STATUS_PROCESS_NOT_IN_JOB"), + SMB_NTSTATUS_PROCESS_IN_JOB => Some("STATUS_PROCESS_IN_JOB"), + SMB_NTSTATUS_VOLSNAP_HIBERNATE_READY => Some("STATUS_VOLSNAP_HIBERNATE_READY"), + SMB_NTSTATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY => { + Some("STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY") + } + SMB_NTSTATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED => { + Some("STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED") + } + SMB_NTSTATUS_INTERRUPT_STILL_CONNECTED => Some("STATUS_INTERRUPT_STILL_CONNECTED"), + SMB_NTSTATUS_PROCESS_CLONED => Some("STATUS_PROCESS_CLONED"), + SMB_NTSTATUS_FILE_LOCKED_WITH_ONLY_READERS => Some("STATUS_FILE_LOCKED_WITH_ONLY_READERS"), + SMB_NTSTATUS_FILE_LOCKED_WITH_WRITERS => Some("STATUS_FILE_LOCKED_WITH_WRITERS"), + SMB_NTSTATUS_RESOURCEMANAGER_READ_ONLY => Some("STATUS_RESOURCEMANAGER_READ_ONLY"), + SMB_NTSTATUS_WAIT_FOR_OPLOCK => Some("STATUS_WAIT_FOR_OPLOCK"), + SMB_NTDBG_EXCEPTION_HANDLED => Some("DBG_EXCEPTION_HANDLED"), + SMB_NTDBG_CONTINUE => Some("DBG_CONTINUE"), + SMB_NTSTATUS_FLT_IO_COMPLETE => Some("STATUS_FLT_IO_COMPLETE"), + SMB_NTSTATUS_FILE_NOT_AVAILABLE => Some("STATUS_FILE_NOT_AVAILABLE"), + SMB_NTSTATUS_SHARE_UNAVAILABLE => Some("STATUS_SHARE_UNAVAILABLE"), + SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_AFFINITY => { + Some("STATUS_CALLBACK_RETURNED_THREAD_AFFINITY") + } + SMB_NTSTATUS_OBJECT_NAME_EXISTS => Some("STATUS_OBJECT_NAME_EXISTS"), + SMB_NTSTATUS_THREAD_WAS_SUSPENDED => Some("STATUS_THREAD_WAS_SUSPENDED"), + SMB_NTSTATUS_WORKING_SET_LIMIT_RANGE => Some("STATUS_WORKING_SET_LIMIT_RANGE"), + SMB_NTSTATUS_IMAGE_NOT_AT_BASE => Some("STATUS_IMAGE_NOT_AT_BASE"), + SMB_NTSTATUS_RXACT_STATE_CREATED => Some("STATUS_RXACT_STATE_CREATED"), + SMB_NTSTATUS_SEGMENT_NOTIFICATION => Some("STATUS_SEGMENT_NOTIFICATION"), + SMB_NTSTATUS_LOCAL_USER_SESSION_KEY => Some("STATUS_LOCAL_USER_SESSION_KEY"), + SMB_NTSTATUS_BAD_CURRENT_DIRECTORY => Some("STATUS_BAD_CURRENT_DIRECTORY"), + SMB_NTSTATUS_SERIAL_MORE_WRITES => Some("STATUS_SERIAL_MORE_WRITES"), + SMB_NTSTATUS_REGISTRY_RECOVERED => Some("STATUS_REGISTRY_RECOVERED"), + SMB_NTSTATUS_FT_READ_RECOVERY_FROM_BACKUP => Some("STATUS_FT_READ_RECOVERY_FROM_BACKUP"), + SMB_NTSTATUS_FT_WRITE_RECOVERY => Some("STATUS_FT_WRITE_RECOVERY"), + SMB_NTSTATUS_SERIAL_COUNTER_TIMEOUT => Some("STATUS_SERIAL_COUNTER_TIMEOUT"), + SMB_NTSTATUS_NULL_LM_PASSWORD => Some("STATUS_NULL_LM_PASSWORD"), + SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH => Some("STATUS_IMAGE_MACHINE_TYPE_MISMATCH"), + SMB_NTSTATUS_RECEIVE_PARTIAL => Some("STATUS_RECEIVE_PARTIAL"), + SMB_NTSTATUS_RECEIVE_EXPEDITED => Some("STATUS_RECEIVE_EXPEDITED"), + SMB_NTSTATUS_RECEIVE_PARTIAL_EXPEDITED => Some("STATUS_RECEIVE_PARTIAL_EXPEDITED"), + SMB_NTSTATUS_EVENT_DONE => Some("STATUS_EVENT_DONE"), + SMB_NTSTATUS_EVENT_PENDING => Some("STATUS_EVENT_PENDING"), + SMB_NTSTATUS_CHECKING_FILE_SYSTEM => Some("STATUS_CHECKING_FILE_SYSTEM"), + SMB_NTSTATUS_FATAL_APP_EXIT => Some("STATUS_FATAL_APP_EXIT"), + SMB_NTSTATUS_PREDEFINED_HANDLE => Some("STATUS_PREDEFINED_HANDLE"), + SMB_NTSTATUS_WAS_UNLOCKED => Some("STATUS_WAS_UNLOCKED"), + SMB_NTSTATUS_SERVICE_NOTIFICATION => Some("STATUS_SERVICE_NOTIFICATION"), + SMB_NTSTATUS_WAS_LOCKED => Some("STATUS_WAS_LOCKED"), + SMB_NTSTATUS_LOG_HARD_ERROR => Some("STATUS_LOG_HARD_ERROR"), + SMB_NTSTATUS_ALREADY_WIN32 => Some("STATUS_ALREADY_WIN32"), + SMB_NTSTATUS_WX86_UNSIMULATE => Some("STATUS_WX86_UNSIMULATE"), + SMB_NTSTATUS_WX86_CONTINUE => Some("STATUS_WX86_CONTINUE"), + SMB_NTSTATUS_WX86_SINGLE_STEP => Some("STATUS_WX86_SINGLE_STEP"), + SMB_NTSTATUS_WX86_BREAKPOINT => Some("STATUS_WX86_BREAKPOINT"), + SMB_NTSTATUS_WX86_EXCEPTION_CONTINUE => Some("STATUS_WX86_EXCEPTION_CONTINUE"), + SMB_NTSTATUS_WX86_EXCEPTION_LASTCHANCE => Some("STATUS_WX86_EXCEPTION_LASTCHANCE"), + SMB_NTSTATUS_WX86_EXCEPTION_CHAIN => Some("STATUS_WX86_EXCEPTION_CHAIN"), + SMB_NTSTATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE => { + Some("STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE") + } + SMB_NTSTATUS_NO_YIELD_PERFORMED => Some("STATUS_NO_YIELD_PERFORMED"), + SMB_NTSTATUS_TIMER_RESUME_IGNORED => Some("STATUS_TIMER_RESUME_IGNORED"), + SMB_NTSTATUS_ARBITRATION_UNHANDLED => Some("STATUS_ARBITRATION_UNHANDLED"), + SMB_NTSTATUS_CARDBUS_NOT_SUPPORTED => Some("STATUS_CARDBUS_NOT_SUPPORTED"), + SMB_NTSTATUS_WX86_CREATEWX86TIB => Some("STATUS_WX86_CREATEWX86TIB"), + SMB_NTSTATUS_MP_PROCESSOR_MISMATCH => Some("STATUS_MP_PROCESSOR_MISMATCH"), + SMB_NTSTATUS_HIBERNATED => Some("STATUS_HIBERNATED"), + SMB_NTSTATUS_RESUME_HIBERNATION => Some("STATUS_RESUME_HIBERNATION"), + SMB_NTSTATUS_FIRMWARE_UPDATED => Some("STATUS_FIRMWARE_UPDATED"), + SMB_NTSTATUS_DRIVERS_LEAKING_LOCKED_PAGES => Some("STATUS_DRIVERS_LEAKING_LOCKED_PAGES"), + SMB_NTSTATUS_MESSAGE_RETRIEVED => Some("STATUS_MESSAGE_RETRIEVED"), + SMB_NTSTATUS_SYSTEM_POWERSTATE_TRANSITION => Some("STATUS_SYSTEM_POWERSTATE_TRANSITION"), + SMB_NTSTATUS_ALPC_CHECK_COMPLETION_LIST => Some("STATUS_ALPC_CHECK_COMPLETION_LIST"), + SMB_NTSTATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION => { + Some("STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION") + } + SMB_NTSTATUS_ACCESS_AUDIT_BY_POLICY => Some("STATUS_ACCESS_AUDIT_BY_POLICY"), + SMB_NTSTATUS_ABANDON_HIBERFILE => Some("STATUS_ABANDON_HIBERFILE"), + SMB_NTSTATUS_BIZRULES_NOT_ENABLED => Some("STATUS_BIZRULES_NOT_ENABLED"), + SMB_NTSTATUS_WAKE_SYSTEM => Some("STATUS_WAKE_SYSTEM"), + SMB_NTSTATUS_DS_SHUTTING_DOWN => Some("STATUS_DS_SHUTTING_DOWN"), + SMB_NTDBG_REPLY_LATER => Some("DBG_REPLY_LATER"), + SMB_NTDBG_UNABLE_TO_PROVIDE_HANDLE => Some("DBG_UNABLE_TO_PROVIDE_HANDLE"), + SMB_NTDBG_TERMINATE_THREAD => Some("DBG_TERMINATE_THREAD"), + SMB_NTDBG_TERMINATE_PROCESS => Some("DBG_TERMINATE_PROCESS"), + SMB_NTDBG_CONTROL_C => Some("DBG_CONTROL_C"), + SMB_NTDBG_PRINTEXCEPTION_C => Some("DBG_PRINTEXCEPTION_C"), + SMB_NTDBG_RIPEXCEPTION => Some("DBG_RIPEXCEPTION"), + SMB_NTDBG_CONTROL_BREAK => Some("DBG_CONTROL_BREAK"), + SMB_NTDBG_COMMAND_EXCEPTION => Some("DBG_COMMAND_EXCEPTION"), + SMB_NTRPC_NT_UUID_LOCAL_ONLY => Some("RPC_NT_UUID_LOCAL_ONLY"), + SMB_NTRPC_NT_SEND_INCOMPLETE => Some("RPC_NT_SEND_INCOMPLETE"), + SMB_NTSTATUS_CTX_CDM_CONNECT => Some("STATUS_CTX_CDM_CONNECT"), + SMB_NTSTATUS_CTX_CDM_DISCONNECT => Some("STATUS_CTX_CDM_DISCONNECT"), + SMB_NTSTATUS_SXS_RELEASE_ACTIVATION_CONTEXT => { + Some("STATUS_SXS_RELEASE_ACTIVATION_CONTEXT") + } + SMB_NTSTATUS_RECOVERY_NOT_NEEDED => Some("STATUS_RECOVERY_NOT_NEEDED"), + SMB_NTSTATUS_RM_ALREADY_STARTED => Some("STATUS_RM_ALREADY_STARTED"), + SMB_NTSTATUS_LOG_NO_RESTART => Some("STATUS_LOG_NO_RESTART"), + SMB_NTSTATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST => { + Some("STATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST") + } + SMB_NTSTATUS_GRAPHICS_PARTIAL_DATA_POPULATED => { + Some("STATUS_GRAPHICS_PARTIAL_DATA_POPULATED") + } + SMB_NTSTATUS_GRAPHICS_DRIVER_MISMATCH => Some("STATUS_GRAPHICS_DRIVER_MISMATCH"), + SMB_NTSTATUS_GRAPHICS_MODE_NOT_PINNED => Some("STATUS_GRAPHICS_MODE_NOT_PINNED"), + SMB_NTSTATUS_GRAPHICS_NO_PREFERRED_MODE => Some("STATUS_GRAPHICS_NO_PREFERRED_MODE"), + SMB_NTSTATUS_GRAPHICS_DATASET_IS_EMPTY => Some("STATUS_GRAPHICS_DATASET_IS_EMPTY"), + SMB_NTSTATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET => { + Some("STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET") + } + SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED => { + Some("STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED") + } + SMB_NTSTATUS_GRAPHICS_UNKNOWN_CHILD_STATUS => Some("STATUS_GRAPHICS_UNKNOWN_CHILD_STATUS"), + SMB_NTSTATUS_GRAPHICS_LEADLINK_START_DEFERRED => { + Some("STATUS_GRAPHICS_LEADLINK_START_DEFERRED") + } + SMB_NTSTATUS_GRAPHICS_POLLING_TOO_FREQUENTLY => { + Some("STATUS_GRAPHICS_POLLING_TOO_FREQUENTLY") + } + SMB_NTSTATUS_GRAPHICS_START_DEFERRED => Some("STATUS_GRAPHICS_START_DEFERRED"), + SMB_NTSTATUS_NDIS_INDICATION_REQUIRED => Some("STATUS_NDIS_INDICATION_REQUIRED"), + SMB_NTSTATUS_GUARD_PAGE_VIOLATION => Some("STATUS_GUARD_PAGE_VIOLATION"), + SMB_NTSTATUS_DATATYPE_MISALIGNMENT => Some("STATUS_DATATYPE_MISALIGNMENT"), + SMB_NTSTATUS_BREAKPOINT => Some("STATUS_BREAKPOINT"), + SMB_NTSTATUS_SINGLE_STEP => Some("STATUS_SINGLE_STEP"), + SMB_NTSTATUS_BUFFER_OVERFLOW => Some("STATUS_BUFFER_OVERFLOW"), + SMB_NTSTATUS_NO_MORE_FILES => Some("STATUS_NO_MORE_FILES"), + SMB_NTSTATUS_WAKE_SYSTEM_DEBUGGER => Some("STATUS_WAKE_SYSTEM_DEBUGGER"), + SMB_NTSTATUS_HANDLES_CLOSED => Some("STATUS_HANDLES_CLOSED"), + SMB_NTSTATUS_NO_INHERITANCE => Some("STATUS_NO_INHERITANCE"), + SMB_NTSTATUS_GUID_SUBSTITUTION_MADE => Some("STATUS_GUID_SUBSTITUTION_MADE"), + SMB_NTSTATUS_PARTIAL_COPY => Some("STATUS_PARTIAL_COPY"), + SMB_NTSTATUS_DEVICE_PAPER_EMPTY => Some("STATUS_DEVICE_PAPER_EMPTY"), + SMB_NTSTATUS_DEVICE_POWERED_OFF => Some("STATUS_DEVICE_POWERED_OFF"), + SMB_NTSTATUS_DEVICE_OFF_LINE => Some("STATUS_DEVICE_OFF_LINE"), + SMB_NTSTATUS_DEVICE_BUSY => Some("STATUS_DEVICE_BUSY"), + SMB_NTSTATUS_NO_MORE_EAS => Some("STATUS_NO_MORE_EAS"), + SMB_NTSTATUS_INVALID_EA_NAME => Some("STATUS_INVALID_EA_NAME"), + SMB_NTSTATUS_EA_LIST_INCONSISTENT => Some("STATUS_EA_LIST_INCONSISTENT"), + SMB_NTSTATUS_INVALID_EA_FLAG => Some("STATUS_INVALID_EA_FLAG"), + SMB_NTSTATUS_VERIFY_REQUIRED => Some("STATUS_VERIFY_REQUIRED"), + SMB_NTSTATUS_EXTRANEOUS_INFORMATION => Some("STATUS_EXTRANEOUS_INFORMATION"), + SMB_NTSTATUS_RXACT_COMMIT_NECESSARY => Some("STATUS_RXACT_COMMIT_NECESSARY"), + SMB_NTSTATUS_NO_MORE_ENTRIES => Some("STATUS_NO_MORE_ENTRIES"), + SMB_NTSTATUS_FILEMARK_DETECTED => Some("STATUS_FILEMARK_DETECTED"), + SMB_NTSTATUS_MEDIA_CHANGED => Some("STATUS_MEDIA_CHANGED"), + SMB_NTSTATUS_BUS_RESET => Some("STATUS_BUS_RESET"), + SMB_NTSTATUS_END_OF_MEDIA => Some("STATUS_END_OF_MEDIA"), + SMB_NTSTATUS_BEGINNING_OF_MEDIA => Some("STATUS_BEGINNING_OF_MEDIA"), + SMB_NTSTATUS_MEDIA_CHECK => Some("STATUS_MEDIA_CHECK"), + SMB_NTSTATUS_SETMARK_DETECTED => Some("STATUS_SETMARK_DETECTED"), + SMB_NTSTATUS_NO_DATA_DETECTED => Some("STATUS_NO_DATA_DETECTED"), + SMB_NTSTATUS_REDIRECTOR_HAS_OPEN_HANDLES => Some("STATUS_REDIRECTOR_HAS_OPEN_HANDLES"), + SMB_NTSTATUS_SERVER_HAS_OPEN_HANDLES => Some("STATUS_SERVER_HAS_OPEN_HANDLES"), + SMB_NTSTATUS_ALREADY_DISCONNECTED => Some("STATUS_ALREADY_DISCONNECTED"), + SMB_NTSTATUS_LONGJUMP => Some("STATUS_LONGJUMP"), + SMB_NTSTATUS_CLEANER_CARTRIDGE_INSTALLED => Some("STATUS_CLEANER_CARTRIDGE_INSTALLED"), + SMB_NTSTATUS_PLUGPLAY_QUERY_VETOED => Some("STATUS_PLUGPLAY_QUERY_VETOED"), + SMB_NTSTATUS_UNWIND_CONSOLIDATE => Some("STATUS_UNWIND_CONSOLIDATE"), + SMB_NTSTATUS_REGISTRY_HIVE_RECOVERED => Some("STATUS_REGISTRY_HIVE_RECOVERED"), + SMB_NTSTATUS_DLL_MIGHT_BE_INSECURE => Some("STATUS_DLL_MIGHT_BE_INSECURE"), + SMB_NTSTATUS_DLL_MIGHT_BE_INCOMPATIBLE => Some("STATUS_DLL_MIGHT_BE_INCOMPATIBLE"), + SMB_NTSTATUS_STOPPED_ON_SYMLINK => Some("STATUS_STOPPED_ON_SYMLINK"), + SMB_NTSTATUS_DEVICE_REQUIRES_CLEANING => Some("STATUS_DEVICE_REQUIRES_CLEANING"), + SMB_NTSTATUS_DEVICE_DOOR_OPEN => Some("STATUS_DEVICE_DOOR_OPEN"), + SMB_NTSTATUS_DATA_LOST_REPAIR => Some("STATUS_DATA_LOST_REPAIR"), + SMB_NTDBG_EXCEPTION_NOT_HANDLED => Some("DBG_EXCEPTION_NOT_HANDLED"), + SMB_NTSTATUS_CLUSTER_NODE_ALREADY_UP => Some("STATUS_CLUSTER_NODE_ALREADY_UP"), + SMB_NTSTATUS_CLUSTER_NODE_ALREADY_DOWN => Some("STATUS_CLUSTER_NODE_ALREADY_DOWN"), + SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_ONLINE => { + Some("STATUS_CLUSTER_NETWORK_ALREADY_ONLINE") + } + SMB_NTSTATUS_CLUSTER_NETWORK_ALREADY_OFFLINE => { + Some("STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE") + } + SMB_NTSTATUS_CLUSTER_NODE_ALREADY_MEMBER => Some("STATUS_CLUSTER_NODE_ALREADY_MEMBER"), + SMB_NTSTATUS_COULD_NOT_RESIZE_LOG => Some("STATUS_COULD_NOT_RESIZE_LOG"), + SMB_NTSTATUS_NO_TXF_METADATA => Some("STATUS_NO_TXF_METADATA"), + SMB_NTSTATUS_CANT_RECOVER_WITH_HANDLE_OPEN => Some("STATUS_CANT_RECOVER_WITH_HANDLE_OPEN"), + SMB_NTSTATUS_TXF_METADATA_ALREADY_PRESENT => Some("STATUS_TXF_METADATA_ALREADY_PRESENT"), + SMB_NTSTATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET => { + Some("STATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET") + } + SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED => { + Some("STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED") + } + SMB_NTSTATUS_FLT_BUFFER_TOO_SMALL => Some("STATUS_FLT_BUFFER_TOO_SMALL"), + SMB_NTSTATUS_FVE_PARTIAL_METADATA => Some("STATUS_FVE_PARTIAL_METADATA"), + SMB_NTSTATUS_FVE_TRANSIENT_STATE => Some("STATUS_FVE_TRANSIENT_STATE"), + SMB_NTSTATUS_UNSUCCESSFUL => Some("STATUS_UNSUCCESSFUL"), + SMB_NTSTATUS_NOT_IMPLEMENTED => Some("STATUS_NOT_IMPLEMENTED"), + SMB_NTSTATUS_INVALID_INFO_CLASS => Some("STATUS_INVALID_INFO_CLASS"), + SMB_NTSTATUS_INFO_LENGTH_MISMATCH => Some("STATUS_INFO_LENGTH_MISMATCH"), + SMB_NTSTATUS_ACCESS_VIOLATION => Some("STATUS_ACCESS_VIOLATION"), + SMB_NTSTATUS_IN_PAGE_ERROR => Some("STATUS_IN_PAGE_ERROR"), + SMB_NTSTATUS_PAGEFILE_QUOTA => Some("STATUS_PAGEFILE_QUOTA"), + SMB_NTSTATUS_INVALID_HANDLE => Some("STATUS_INVALID_HANDLE"), + SMB_NTSTATUS_BAD_INITIAL_STACK => Some("STATUS_BAD_INITIAL_STACK"), + SMB_NTSTATUS_BAD_INITIAL_PC => Some("STATUS_BAD_INITIAL_PC"), + SMB_NTSTATUS_INVALID_CID => Some("STATUS_INVALID_CID"), + SMB_NTSTATUS_TIMER_NOT_CANCELED => Some("STATUS_TIMER_NOT_CANCELED"), + SMB_NTSTATUS_INVALID_PARAMETER => Some("STATUS_INVALID_PARAMETER"), + SMB_NTSTATUS_NO_SUCH_DEVICE => Some("STATUS_NO_SUCH_DEVICE"), + SMB_NTSTATUS_NO_SUCH_FILE => Some("STATUS_NO_SUCH_FILE"), + SMB_NTSTATUS_INVALID_DEVICE_REQUEST => Some("STATUS_INVALID_DEVICE_REQUEST"), + SMB_NTSTATUS_END_OF_FILE => Some("STATUS_END_OF_FILE"), + SMB_NTSTATUS_WRONG_VOLUME => Some("STATUS_WRONG_VOLUME"), + SMB_NTSTATUS_NO_MEDIA_IN_DEVICE => Some("STATUS_NO_MEDIA_IN_DEVICE"), + SMB_NTSTATUS_UNRECOGNIZED_MEDIA => Some("STATUS_UNRECOGNIZED_MEDIA"), + SMB_NTSTATUS_NONEXISTENT_SECTOR => Some("STATUS_NONEXISTENT_SECTOR"), + SMB_NTSTATUS_MORE_PROCESSING_REQUIRED => Some("STATUS_MORE_PROCESSING_REQUIRED"), + SMB_NTSTATUS_NO_MEMORY => Some("STATUS_NO_MEMORY"), + SMB_NTSTATUS_CONFLICTING_ADDRESSES => Some("STATUS_CONFLICTING_ADDRESSES"), + SMB_NTSTATUS_NOT_MAPPED_VIEW => Some("STATUS_NOT_MAPPED_VIEW"), + SMB_NTSTATUS_UNABLE_TO_FREE_VM => Some("STATUS_UNABLE_TO_FREE_VM"), + SMB_NTSTATUS_UNABLE_TO_DELETE_SECTION => Some("STATUS_UNABLE_TO_DELETE_SECTION"), + SMB_NTSTATUS_INVALID_SYSTEM_SERVICE => Some("STATUS_INVALID_SYSTEM_SERVICE"), + SMB_NTSTATUS_ILLEGAL_INSTRUCTION => Some("STATUS_ILLEGAL_INSTRUCTION"), + SMB_NTSTATUS_INVALID_LOCK_SEQUENCE => Some("STATUS_INVALID_LOCK_SEQUENCE"), + SMB_NTSTATUS_INVALID_VIEW_SIZE => Some("STATUS_INVALID_VIEW_SIZE"), + SMB_NTSTATUS_INVALID_FILE_FOR_SECTION => Some("STATUS_INVALID_FILE_FOR_SECTION"), + SMB_NTSTATUS_ALREADY_COMMITTED => Some("STATUS_ALREADY_COMMITTED"), + SMB_NTSTATUS_ACCESS_DENIED => Some("STATUS_ACCESS_DENIED"), + SMB_NTSTATUS_BUFFER_TOO_SMALL => Some("STATUS_BUFFER_TOO_SMALL"), + SMB_NTSTATUS_OBJECT_TYPE_MISMATCH => Some("STATUS_OBJECT_TYPE_MISMATCH"), + SMB_NTSTATUS_NONCONTINUABLE_EXCEPTION => Some("STATUS_NONCONTINUABLE_EXCEPTION"), + SMB_NTSTATUS_INVALID_DISPOSITION => Some("STATUS_INVALID_DISPOSITION"), + SMB_NTSTATUS_UNWIND => Some("STATUS_UNWIND"), + SMB_NTSTATUS_BAD_STACK => Some("STATUS_BAD_STACK"), + SMB_NTSTATUS_INVALID_UNWIND_TARGET => Some("STATUS_INVALID_UNWIND_TARGET"), + SMB_NTSTATUS_NOT_LOCKED => Some("STATUS_NOT_LOCKED"), + SMB_NTSTATUS_PARITY_ERROR => Some("STATUS_PARITY_ERROR"), + SMB_NTSTATUS_UNABLE_TO_DECOMMIT_VM => Some("STATUS_UNABLE_TO_DECOMMIT_VM"), + SMB_NTSTATUS_NOT_COMMITTED => Some("STATUS_NOT_COMMITTED"), + SMB_NTSTATUS_INVALID_PORT_ATTRIBUTES => Some("STATUS_INVALID_PORT_ATTRIBUTES"), + SMB_NTSTATUS_PORT_MESSAGE_TOO_LONG => Some("STATUS_PORT_MESSAGE_TOO_LONG"), + SMB_NTSTATUS_INVALID_PARAMETER_MIX => Some("STATUS_INVALID_PARAMETER_MIX"), + SMB_NTSTATUS_INVALID_QUOTA_LOWER => Some("STATUS_INVALID_QUOTA_LOWER"), + SMB_NTSTATUS_DISK_CORRUPT_ERROR => Some("STATUS_DISK_CORRUPT_ERROR"), + SMB_NTSTATUS_OBJECT_NAME_INVALID => Some("STATUS_OBJECT_NAME_INVALID"), + SMB_NTSTATUS_OBJECT_NAME_NOT_FOUND => Some("STATUS_OBJECT_NAME_NOT_FOUND"), + SMB_NTSTATUS_OBJECT_NAME_COLLISION => Some("STATUS_OBJECT_NAME_COLLISION"), + SMB_NTSTATUS_PORT_DISCONNECTED => Some("STATUS_PORT_DISCONNECTED"), + SMB_NTSTATUS_DEVICE_ALREADY_ATTACHED => Some("STATUS_DEVICE_ALREADY_ATTACHED"), + SMB_NTSTATUS_OBJECT_PATH_INVALID => Some("STATUS_OBJECT_PATH_INVALID"), + SMB_NTSTATUS_OBJECT_PATH_NOT_FOUND => Some("STATUS_OBJECT_PATH_NOT_FOUND"), + SMB_NTSTATUS_OBJECT_PATH_SYNTAX_BAD => Some("STATUS_OBJECT_PATH_SYNTAX_BAD"), + SMB_NTSTATUS_DATA_OVERRUN => Some("STATUS_DATA_OVERRUN"), + SMB_NTSTATUS_DATA_LATE_ERROR => Some("STATUS_DATA_LATE_ERROR"), + SMB_NTSTATUS_DATA_ERROR => Some("STATUS_DATA_ERROR"), + SMB_NTSTATUS_CRC_ERROR => Some("STATUS_CRC_ERROR"), + SMB_NTSTATUS_SECTION_TOO_BIG => Some("STATUS_SECTION_TOO_BIG"), + SMB_NTSTATUS_PORT_CONNECTION_REFUSED => Some("STATUS_PORT_CONNECTION_REFUSED"), + SMB_NTSTATUS_INVALID_PORT_HANDLE => Some("STATUS_INVALID_PORT_HANDLE"), + SMB_NTSTATUS_SHARING_VIOLATION => Some("STATUS_SHARING_VIOLATION"), + SMB_NTSTATUS_QUOTA_EXCEEDED => Some("STATUS_QUOTA_EXCEEDED"), + SMB_NTSTATUS_INVALID_PAGE_PROTECTION => Some("STATUS_INVALID_PAGE_PROTECTION"), + SMB_NTSTATUS_MUTANT_NOT_OWNED => Some("STATUS_MUTANT_NOT_OWNED"), + SMB_NTSTATUS_SEMAPHORE_LIMIT_EXCEEDED => Some("STATUS_SEMAPHORE_LIMIT_EXCEEDED"), + SMB_NTSTATUS_PORT_ALREADY_SET => Some("STATUS_PORT_ALREADY_SET"), + SMB_NTSTATUS_SECTION_NOT_IMAGE => Some("STATUS_SECTION_NOT_IMAGE"), + SMB_NTSTATUS_SUSPEND_COUNT_EXCEEDED => Some("STATUS_SUSPEND_COUNT_EXCEEDED"), + SMB_NTSTATUS_THREAD_IS_TERMINATING => Some("STATUS_THREAD_IS_TERMINATING"), + SMB_NTSTATUS_BAD_WORKING_SET_LIMIT => Some("STATUS_BAD_WORKING_SET_LIMIT"), + SMB_NTSTATUS_INCOMPATIBLE_FILE_MAP => Some("STATUS_INCOMPATIBLE_FILE_MAP"), + SMB_NTSTATUS_SECTION_PROTECTION => Some("STATUS_SECTION_PROTECTION"), + SMB_NTSTATUS_EAS_NOT_SUPPORTED => Some("STATUS_EAS_NOT_SUPPORTED"), + SMB_NTSTATUS_EA_TOO_LARGE => Some("STATUS_EA_TOO_LARGE"), + SMB_NTSTATUS_NONEXISTENT_EA_ENTRY => Some("STATUS_NONEXISTENT_EA_ENTRY"), + SMB_NTSTATUS_NO_EAS_ON_FILE => Some("STATUS_NO_EAS_ON_FILE"), + SMB_NTSTATUS_EA_CORRUPT_ERROR => Some("STATUS_EA_CORRUPT_ERROR"), + SMB_NTSTATUS_FILE_LOCK_CONFLICT => Some("STATUS_FILE_LOCK_CONFLICT"), + SMB_NTSTATUS_LOCK_NOT_GRANTED => Some("STATUS_LOCK_NOT_GRANTED"), + SMB_NTSTATUS_DELETE_PENDING => Some("STATUS_DELETE_PENDING"), + SMB_NTSTATUS_CTL_FILE_NOT_SUPPORTED => Some("STATUS_CTL_FILE_NOT_SUPPORTED"), + SMB_NTSTATUS_UNKNOWN_REVISION => Some("STATUS_UNKNOWN_REVISION"), + SMB_NTSTATUS_REVISION_MISMATCH => Some("STATUS_REVISION_MISMATCH"), + SMB_NTSTATUS_INVALID_OWNER => Some("STATUS_INVALID_OWNER"), + SMB_NTSTATUS_INVALID_PRIMARY_GROUP => Some("STATUS_INVALID_PRIMARY_GROUP"), + SMB_NTSTATUS_NO_IMPERSONATION_TOKEN => Some("STATUS_NO_IMPERSONATION_TOKEN"), + SMB_NTSTATUS_CANT_DISABLE_MANDATORY => Some("STATUS_CANT_DISABLE_MANDATORY"), + SMB_NTSTATUS_NO_LOGON_SERVERS => Some("STATUS_NO_LOGON_SERVERS"), + SMB_NTSTATUS_NO_SUCH_LOGON_SESSION => Some("STATUS_NO_SUCH_LOGON_SESSION"), + SMB_NTSTATUS_NO_SUCH_PRIVILEGE => Some("STATUS_NO_SUCH_PRIVILEGE"), + SMB_NTSTATUS_PRIVILEGE_NOT_HELD => Some("STATUS_PRIVILEGE_NOT_HELD"), + SMB_NTSTATUS_INVALID_ACCOUNT_NAME => Some("STATUS_INVALID_ACCOUNT_NAME"), + SMB_NTSTATUS_USER_EXISTS => Some("STATUS_USER_EXISTS"), + SMB_NTSTATUS_NO_SUCH_USER => Some("STATUS_NO_SUCH_USER"), + SMB_NTSTATUS_GROUP_EXISTS => Some("STATUS_GROUP_EXISTS"), + SMB_NTSTATUS_NO_SUCH_GROUP => Some("STATUS_NO_SUCH_GROUP"), + SMB_NTSTATUS_MEMBER_IN_GROUP => Some("STATUS_MEMBER_IN_GROUP"), + SMB_NTSTATUS_MEMBER_NOT_IN_GROUP => Some("STATUS_MEMBER_NOT_IN_GROUP"), + SMB_NTSTATUS_LAST_ADMIN => Some("STATUS_LAST_ADMIN"), + SMB_NTSTATUS_WRONG_PASSWORD => Some("STATUS_WRONG_PASSWORD"), + SMB_NTSTATUS_ILL_FORMED_PASSWORD => Some("STATUS_ILL_FORMED_PASSWORD"), + SMB_NTSTATUS_PASSWORD_RESTRICTION => Some("STATUS_PASSWORD_RESTRICTION"), + SMB_NTSTATUS_LOGON_FAILURE => Some("STATUS_LOGON_FAILURE"), + SMB_NTSTATUS_ACCOUNT_RESTRICTION => Some("STATUS_ACCOUNT_RESTRICTION"), + SMB_NTSTATUS_INVALID_LOGON_HOURS => Some("STATUS_INVALID_LOGON_HOURS"), + SMB_NTSTATUS_INVALID_WORKSTATION => Some("STATUS_INVALID_WORKSTATION"), + SMB_NTSTATUS_PASSWORD_EXPIRED => Some("STATUS_PASSWORD_EXPIRED"), + SMB_NTSTATUS_ACCOUNT_DISABLED => Some("STATUS_ACCOUNT_DISABLED"), + SMB_NTSTATUS_NONE_MAPPED => Some("STATUS_NONE_MAPPED"), + SMB_NTSTATUS_TOO_MANY_LUIDS_REQUESTED => Some("STATUS_TOO_MANY_LUIDS_REQUESTED"), + SMB_NTSTATUS_LUIDS_EXHAUSTED => Some("STATUS_LUIDS_EXHAUSTED"), + SMB_NTSTATUS_INVALID_SUB_AUTHORITY => Some("STATUS_INVALID_SUB_AUTHORITY"), + SMB_NTSTATUS_INVALID_ACL => Some("STATUS_INVALID_ACL"), + SMB_NTSTATUS_INVALID_SID => Some("STATUS_INVALID_SID"), + SMB_NTSTATUS_INVALID_SECURITY_DESCR => Some("STATUS_INVALID_SECURITY_DESCR"), + SMB_NTSTATUS_PROCEDURE_NOT_FOUND => Some("STATUS_PROCEDURE_NOT_FOUND"), + SMB_NTSTATUS_INVALID_IMAGE_FORMAT => Some("STATUS_INVALID_IMAGE_FORMAT"), + SMB_NTSTATUS_NO_TOKEN => Some("STATUS_NO_TOKEN"), + SMB_NTSTATUS_BAD_INHERITANCE_ACL => Some("STATUS_BAD_INHERITANCE_ACL"), + SMB_NTSTATUS_RANGE_NOT_LOCKED => Some("STATUS_RANGE_NOT_LOCKED"), + SMB_NTSTATUS_DISK_FULL => Some("STATUS_DISK_FULL"), + SMB_NTSTATUS_SERVER_DISABLED => Some("STATUS_SERVER_DISABLED"), + SMB_NTSTATUS_SERVER_NOT_DISABLED => Some("STATUS_SERVER_NOT_DISABLED"), + SMB_NTSTATUS_TOO_MANY_GUIDS_REQUESTED => Some("STATUS_TOO_MANY_GUIDS_REQUESTED"), + SMB_NTSTATUS_GUIDS_EXHAUSTED => Some("STATUS_GUIDS_EXHAUSTED"), + SMB_NTSTATUS_INVALID_ID_AUTHORITY => Some("STATUS_INVALID_ID_AUTHORITY"), + SMB_NTSTATUS_AGENTS_EXHAUSTED => Some("STATUS_AGENTS_EXHAUSTED"), + SMB_NTSTATUS_INVALID_VOLUME_LABEL => Some("STATUS_INVALID_VOLUME_LABEL"), + SMB_NTSTATUS_SECTION_NOT_EXTENDED => Some("STATUS_SECTION_NOT_EXTENDED"), + SMB_NTSTATUS_NOT_MAPPED_DATA => Some("STATUS_NOT_MAPPED_DATA"), + SMB_NTSTATUS_RESOURCE_DATA_NOT_FOUND => Some("STATUS_RESOURCE_DATA_NOT_FOUND"), + SMB_NTSTATUS_RESOURCE_TYPE_NOT_FOUND => Some("STATUS_RESOURCE_TYPE_NOT_FOUND"), + SMB_NTSTATUS_RESOURCE_NAME_NOT_FOUND => Some("STATUS_RESOURCE_NAME_NOT_FOUND"), + SMB_NTSTATUS_ARRAY_BOUNDS_EXCEEDED => Some("STATUS_ARRAY_BOUNDS_EXCEEDED"), + SMB_NTSTATUS_FLOAT_DENORMAL_OPERAND => Some("STATUS_FLOAT_DENORMAL_OPERAND"), + SMB_NTSTATUS_FLOAT_DIVIDE_BY_ZERO => Some("STATUS_FLOAT_DIVIDE_BY_ZERO"), + SMB_NTSTATUS_FLOAT_INEXACT_RESULT => Some("STATUS_FLOAT_INEXACT_RESULT"), + SMB_NTSTATUS_FLOAT_INVALID_OPERATION => Some("STATUS_FLOAT_INVALID_OPERATION"), + SMB_NTSTATUS_FLOAT_OVERFLOW => Some("STATUS_FLOAT_OVERFLOW"), + SMB_NTSTATUS_FLOAT_STACK_CHECK => Some("STATUS_FLOAT_STACK_CHECK"), + SMB_NTSTATUS_FLOAT_UNDERFLOW => Some("STATUS_FLOAT_UNDERFLOW"), + SMB_NTSTATUS_INTEGER_DIVIDE_BY_ZERO => Some("STATUS_INTEGER_DIVIDE_BY_ZERO"), + SMB_NTSTATUS_INTEGER_OVERFLOW => Some("STATUS_INTEGER_OVERFLOW"), + SMB_NTSTATUS_PRIVILEGED_INSTRUCTION => Some("STATUS_PRIVILEGED_INSTRUCTION"), + SMB_NTSTATUS_TOO_MANY_PAGING_FILES => Some("STATUS_TOO_MANY_PAGING_FILES"), + SMB_NTSTATUS_FILE_INVALID => Some("STATUS_FILE_INVALID"), + SMB_NTSTATUS_ALLOTTED_SPACE_EXCEEDED => Some("STATUS_ALLOTTED_SPACE_EXCEEDED"), + SMB_NTSTATUS_INSUFFICIENT_RESOURCES => Some("STATUS_INSUFFICIENT_RESOURCES"), + SMB_NTSTATUS_DFS_EXIT_PATH_FOUND => Some("STATUS_DFS_EXIT_PATH_FOUND"), + SMB_NTSTATUS_DEVICE_DATA_ERROR => Some("STATUS_DEVICE_DATA_ERROR"), + SMB_NTSTATUS_DEVICE_NOT_CONNECTED => Some("STATUS_DEVICE_NOT_CONNECTED"), + SMB_NTSTATUS_FREE_VM_NOT_AT_BASE => Some("STATUS_FREE_VM_NOT_AT_BASE"), + SMB_NTSTATUS_MEMORY_NOT_ALLOCATED => Some("STATUS_MEMORY_NOT_ALLOCATED"), + SMB_NTSTATUS_WORKING_SET_QUOTA => Some("STATUS_WORKING_SET_QUOTA"), + SMB_NTSTATUS_MEDIA_WRITE_PROTECTED => Some("STATUS_MEDIA_WRITE_PROTECTED"), + SMB_NTSTATUS_DEVICE_NOT_READY => Some("STATUS_DEVICE_NOT_READY"), + SMB_NTSTATUS_INVALID_GROUP_ATTRIBUTES => Some("STATUS_INVALID_GROUP_ATTRIBUTES"), + SMB_NTSTATUS_BAD_IMPERSONATION_LEVEL => Some("STATUS_BAD_IMPERSONATION_LEVEL"), + SMB_NTSTATUS_CANT_OPEN_ANONYMOUS => Some("STATUS_CANT_OPEN_ANONYMOUS"), + SMB_NTSTATUS_BAD_VALIDATION_CLASS => Some("STATUS_BAD_VALIDATION_CLASS"), + SMB_NTSTATUS_BAD_TOKEN_TYPE => Some("STATUS_BAD_TOKEN_TYPE"), + SMB_NTSTATUS_BAD_MASTER_BOOT_RECORD => Some("STATUS_BAD_MASTER_BOOT_RECORD"), + SMB_NTSTATUS_INSTRUCTION_MISALIGNMENT => Some("STATUS_INSTRUCTION_MISALIGNMENT"), + SMB_NTSTATUS_INSTANCE_NOT_AVAILABLE => Some("STATUS_INSTANCE_NOT_AVAILABLE"), + SMB_NTSTATUS_PIPE_NOT_AVAILABLE => Some("STATUS_PIPE_NOT_AVAILABLE"), + SMB_NTSTATUS_INVALID_PIPE_STATE => Some("STATUS_INVALID_PIPE_STATE"), + SMB_NTSTATUS_PIPE_BUSY => Some("STATUS_PIPE_BUSY"), + SMB_NTSTATUS_ILLEGAL_FUNCTION => Some("STATUS_ILLEGAL_FUNCTION"), + SMB_NTSTATUS_PIPE_DISCONNECTED => Some("STATUS_PIPE_DISCONNECTED"), + SMB_NTSTATUS_PIPE_CLOSING => Some("STATUS_PIPE_CLOSING"), + SMB_NTSTATUS_PIPE_CONNECTED => Some("STATUS_PIPE_CONNECTED"), + SMB_NTSTATUS_PIPE_LISTENING => Some("STATUS_PIPE_LISTENING"), + SMB_NTSTATUS_INVALID_READ_MODE => Some("STATUS_INVALID_READ_MODE"), + SMB_NTSTATUS_IO_TIMEOUT => Some("STATUS_IO_TIMEOUT"), + SMB_NTSTATUS_FILE_FORCED_CLOSED => Some("STATUS_FILE_FORCED_CLOSED"), + SMB_NTSTATUS_PROFILING_NOT_STARTED => Some("STATUS_PROFILING_NOT_STARTED"), + SMB_NTSTATUS_PROFILING_NOT_STOPPED => Some("STATUS_PROFILING_NOT_STOPPED"), + SMB_NTSTATUS_COULD_NOT_INTERPRET => Some("STATUS_COULD_NOT_INTERPRET"), + SMB_NTSTATUS_FILE_IS_A_DIRECTORY => Some("STATUS_FILE_IS_A_DIRECTORY"), + SMB_NTSTATUS_NOT_SUPPORTED => Some("STATUS_NOT_SUPPORTED"), + SMB_NTSTATUS_REMOTE_NOT_LISTENING => Some("STATUS_REMOTE_NOT_LISTENING"), + SMB_NTSTATUS_DUPLICATE_NAME => Some("STATUS_DUPLICATE_NAME"), + SMB_NTSTATUS_BAD_NETWORK_PATH => Some("STATUS_BAD_NETWORK_PATH"), + SMB_NTSTATUS_NETWORK_BUSY => Some("STATUS_NETWORK_BUSY"), + SMB_NTSTATUS_DEVICE_DOES_NOT_EXIST => Some("STATUS_DEVICE_DOES_NOT_EXIST"), + SMB_NTSTATUS_TOO_MANY_COMMANDS => Some("STATUS_TOO_MANY_COMMANDS"), + SMB_NTSTATUS_ADAPTER_HARDWARE_ERROR => Some("STATUS_ADAPTER_HARDWARE_ERROR"), + SMB_NTSTATUS_INVALID_NETWORK_RESPONSE => Some("STATUS_INVALID_NETWORK_RESPONSE"), + SMB_NTSTATUS_UNEXPECTED_NETWORK_ERROR => Some("STATUS_UNEXPECTED_NETWORK_ERROR"), + SMB_NTSTATUS_BAD_REMOTE_ADAPTER => Some("STATUS_BAD_REMOTE_ADAPTER"), + SMB_NTSTATUS_PRINT_QUEUE_FULL => Some("STATUS_PRINT_QUEUE_FULL"), + SMB_NTSTATUS_NO_SPOOL_SPACE => Some("STATUS_NO_SPOOL_SPACE"), + SMB_NTSTATUS_PRINT_CANCELLED => Some("STATUS_PRINT_CANCELLED"), + SMB_NTSTATUS_NETWORK_NAME_DELETED => Some("STATUS_NETWORK_NAME_DELETED"), + SMB_NTSTATUS_NETWORK_ACCESS_DENIED => Some("STATUS_NETWORK_ACCESS_DENIED"), + SMB_NTSTATUS_BAD_DEVICE_TYPE => Some("STATUS_BAD_DEVICE_TYPE"), + SMB_NTSTATUS_BAD_NETWORK_NAME => Some("STATUS_BAD_NETWORK_NAME"), + SMB_NTSTATUS_TOO_MANY_NAMES => Some("STATUS_TOO_MANY_NAMES"), + SMB_NTSTATUS_TOO_MANY_SESSIONS => Some("STATUS_TOO_MANY_SESSIONS"), + SMB_NTSTATUS_SHARING_PAUSED => Some("STATUS_SHARING_PAUSED"), + SMB_NTSTATUS_REQUEST_NOT_ACCEPTED => Some("STATUS_REQUEST_NOT_ACCEPTED"), + SMB_NTSTATUS_REDIRECTOR_PAUSED => Some("STATUS_REDIRECTOR_PAUSED"), + SMB_NTSTATUS_NET_WRITE_FAULT => Some("STATUS_NET_WRITE_FAULT"), + SMB_NTSTATUS_PROFILING_AT_LIMIT => Some("STATUS_PROFILING_AT_LIMIT"), + SMB_NTSTATUS_NOT_SAME_DEVICE => Some("STATUS_NOT_SAME_DEVICE"), + SMB_NTSTATUS_FILE_RENAMED => Some("STATUS_FILE_RENAMED"), + SMB_NTSTATUS_VIRTUAL_CIRCUIT_CLOSED => Some("STATUS_VIRTUAL_CIRCUIT_CLOSED"), + SMB_NTSTATUS_NO_SECURITY_ON_OBJECT => Some("STATUS_NO_SECURITY_ON_OBJECT"), + SMB_NTSTATUS_CANT_WAIT => Some("STATUS_CANT_WAIT"), + SMB_NTSTATUS_PIPE_EMPTY => Some("STATUS_PIPE_EMPTY"), + SMB_NTSTATUS_CANT_ACCESS_DOMAIN_INFO => Some("STATUS_CANT_ACCESS_DOMAIN_INFO"), + SMB_NTSTATUS_CANT_TERMINATE_SELF => Some("STATUS_CANT_TERMINATE_SELF"), + SMB_NTSTATUS_INVALID_SERVER_STATE => Some("STATUS_INVALID_SERVER_STATE"), + SMB_NTSTATUS_INVALID_DOMAIN_STATE => Some("STATUS_INVALID_DOMAIN_STATE"), + SMB_NTSTATUS_INVALID_DOMAIN_ROLE => Some("STATUS_INVALID_DOMAIN_ROLE"), + SMB_NTSTATUS_NO_SUCH_DOMAIN => Some("STATUS_NO_SUCH_DOMAIN"), + SMB_NTSTATUS_DOMAIN_EXISTS => Some("STATUS_DOMAIN_EXISTS"), + SMB_NTSTATUS_DOMAIN_LIMIT_EXCEEDED => Some("STATUS_DOMAIN_LIMIT_EXCEEDED"), + SMB_NTSTATUS_OPLOCK_NOT_GRANTED => Some("STATUS_OPLOCK_NOT_GRANTED"), + SMB_NTSTATUS_INVALID_OPLOCK_PROTOCOL => Some("STATUS_INVALID_OPLOCK_PROTOCOL"), + SMB_NTSTATUS_INTERNAL_DB_CORRUPTION => Some("STATUS_INTERNAL_DB_CORRUPTION"), + SMB_NTSTATUS_INTERNAL_ERROR => Some("STATUS_INTERNAL_ERROR"), + SMB_NTSTATUS_GENERIC_NOT_MAPPED => Some("STATUS_GENERIC_NOT_MAPPED"), + SMB_NTSTATUS_BAD_DESCRIPTOR_FORMAT => Some("STATUS_BAD_DESCRIPTOR_FORMAT"), + SMB_NTSTATUS_INVALID_USER_BUFFER => Some("STATUS_INVALID_USER_BUFFER"), + SMB_NTSTATUS_UNEXPECTED_IO_ERROR => Some("STATUS_UNEXPECTED_IO_ERROR"), + SMB_NTSTATUS_UNEXPECTED_MM_CREATE_ERR => Some("STATUS_UNEXPECTED_MM_CREATE_ERR"), + SMB_NTSTATUS_UNEXPECTED_MM_MAP_ERROR => Some("STATUS_UNEXPECTED_MM_MAP_ERROR"), + SMB_NTSTATUS_UNEXPECTED_MM_EXTEND_ERR => Some("STATUS_UNEXPECTED_MM_EXTEND_ERR"), + SMB_NTSTATUS_NOT_LOGON_PROCESS => Some("STATUS_NOT_LOGON_PROCESS"), + SMB_NTSTATUS_LOGON_SESSION_EXISTS => Some("STATUS_LOGON_SESSION_EXISTS"), + SMB_NTSTATUS_INVALID_PARAMETER_1 => Some("STATUS_INVALID_PARAMETER_1"), + SMB_NTSTATUS_INVALID_PARAMETER_2 => Some("STATUS_INVALID_PARAMETER_2"), + SMB_NTSTATUS_INVALID_PARAMETER_3 => Some("STATUS_INVALID_PARAMETER_3"), + SMB_NTSTATUS_INVALID_PARAMETER_4 => Some("STATUS_INVALID_PARAMETER_4"), + SMB_NTSTATUS_INVALID_PARAMETER_5 => Some("STATUS_INVALID_PARAMETER_5"), + SMB_NTSTATUS_INVALID_PARAMETER_6 => Some("STATUS_INVALID_PARAMETER_6"), + SMB_NTSTATUS_INVALID_PARAMETER_7 => Some("STATUS_INVALID_PARAMETER_7"), + SMB_NTSTATUS_INVALID_PARAMETER_8 => Some("STATUS_INVALID_PARAMETER_8"), + SMB_NTSTATUS_INVALID_PARAMETER_9 => Some("STATUS_INVALID_PARAMETER_9"), + SMB_NTSTATUS_INVALID_PARAMETER_10 => Some("STATUS_INVALID_PARAMETER_10"), + SMB_NTSTATUS_INVALID_PARAMETER_11 => Some("STATUS_INVALID_PARAMETER_11"), + SMB_NTSTATUS_INVALID_PARAMETER_12 => Some("STATUS_INVALID_PARAMETER_12"), + SMB_NTSTATUS_REDIRECTOR_NOT_STARTED => Some("STATUS_REDIRECTOR_NOT_STARTED"), + SMB_NTSTATUS_REDIRECTOR_STARTED => Some("STATUS_REDIRECTOR_STARTED"), + SMB_NTSTATUS_STACK_OVERFLOW => Some("STATUS_STACK_OVERFLOW"), + SMB_NTSTATUS_NO_SUCH_PACKAGE => Some("STATUS_NO_SUCH_PACKAGE"), + SMB_NTSTATUS_BAD_FUNCTION_TABLE => Some("STATUS_BAD_FUNCTION_TABLE"), + SMB_NTSTATUS_VARIABLE_NOT_FOUND => Some("STATUS_VARIABLE_NOT_FOUND"), + SMB_NTSTATUS_DIRECTORY_NOT_EMPTY => Some("STATUS_DIRECTORY_NOT_EMPTY"), + SMB_NTSTATUS_FILE_CORRUPT_ERROR => Some("STATUS_FILE_CORRUPT_ERROR"), + SMB_NTSTATUS_NOT_A_DIRECTORY => Some("STATUS_NOT_A_DIRECTORY"), + SMB_NTSTATUS_BAD_LOGON_SESSION_STATE => Some("STATUS_BAD_LOGON_SESSION_STATE"), + SMB_NTSTATUS_LOGON_SESSION_COLLISION => Some("STATUS_LOGON_SESSION_COLLISION"), + SMB_NTSTATUS_NAME_TOO_LONG => Some("STATUS_NAME_TOO_LONG"), + SMB_NTSTATUS_FILES_OPEN => Some("STATUS_FILES_OPEN"), + SMB_NTSTATUS_CONNECTION_IN_USE => Some("STATUS_CONNECTION_IN_USE"), + SMB_NTSTATUS_MESSAGE_NOT_FOUND => Some("STATUS_MESSAGE_NOT_FOUND"), + SMB_NTSTATUS_PROCESS_IS_TERMINATING => Some("STATUS_PROCESS_IS_TERMINATING"), + SMB_NTSTATUS_INVALID_LOGON_TYPE => Some("STATUS_INVALID_LOGON_TYPE"), + SMB_NTSTATUS_NO_GUID_TRANSLATION => Some("STATUS_NO_GUID_TRANSLATION"), + SMB_NTSTATUS_CANNOT_IMPERSONATE => Some("STATUS_CANNOT_IMPERSONATE"), + SMB_NTSTATUS_IMAGE_ALREADY_LOADED => Some("STATUS_IMAGE_ALREADY_LOADED"), + SMB_NTSTATUS_NO_LDT => Some("STATUS_NO_LDT"), + SMB_NTSTATUS_INVALID_LDT_SIZE => Some("STATUS_INVALID_LDT_SIZE"), + SMB_NTSTATUS_INVALID_LDT_OFFSET => Some("STATUS_INVALID_LDT_OFFSET"), + SMB_NTSTATUS_INVALID_LDT_DESCRIPTOR => Some("STATUS_INVALID_LDT_DESCRIPTOR"), + SMB_NTSTATUS_INVALID_IMAGE_NE_FORMAT => Some("STATUS_INVALID_IMAGE_NE_FORMAT"), + SMB_NTSTATUS_RXACT_INVALID_STATE => Some("STATUS_RXACT_INVALID_STATE"), + SMB_NTSTATUS_RXACT_COMMIT_FAILURE => Some("STATUS_RXACT_COMMIT_FAILURE"), + SMB_NTSTATUS_MAPPED_FILE_SIZE_ZERO => Some("STATUS_MAPPED_FILE_SIZE_ZERO"), + SMB_NTSTATUS_TOO_MANY_OPENED_FILES => Some("STATUS_TOO_MANY_OPENED_FILES"), + SMB_NTSTATUS_CANCELLED => Some("STATUS_CANCELLED"), + SMB_NTSTATUS_CANNOT_DELETE => Some("STATUS_CANNOT_DELETE"), + SMB_NTSTATUS_INVALID_COMPUTER_NAME => Some("STATUS_INVALID_COMPUTER_NAME"), + SMB_NTSTATUS_FILE_DELETED => Some("STATUS_FILE_DELETED"), + SMB_NTSTATUS_SPECIAL_ACCOUNT => Some("STATUS_SPECIAL_ACCOUNT"), + SMB_NTSTATUS_SPECIAL_GROUP => Some("STATUS_SPECIAL_GROUP"), + SMB_NTSTATUS_SPECIAL_USER => Some("STATUS_SPECIAL_USER"), + SMB_NTSTATUS_MEMBERS_PRIMARY_GROUP => Some("STATUS_MEMBERS_PRIMARY_GROUP"), + SMB_NTSTATUS_FILE_CLOSED => Some("STATUS_FILE_CLOSED"), + SMB_NTSTATUS_TOO_MANY_THREADS => Some("STATUS_TOO_MANY_THREADS"), + SMB_NTSTATUS_THREAD_NOT_IN_PROCESS => Some("STATUS_THREAD_NOT_IN_PROCESS"), + SMB_NTSTATUS_TOKEN_ALREADY_IN_USE => Some("STATUS_TOKEN_ALREADY_IN_USE"), + SMB_NTSTATUS_PAGEFILE_QUOTA_EXCEEDED => Some("STATUS_PAGEFILE_QUOTA_EXCEEDED"), + SMB_NTSTATUS_COMMITMENT_LIMIT => Some("STATUS_COMMITMENT_LIMIT"), + SMB_NTSTATUS_INVALID_IMAGE_LE_FORMAT => Some("STATUS_INVALID_IMAGE_LE_FORMAT"), + SMB_NTSTATUS_INVALID_IMAGE_NOT_MZ => Some("STATUS_INVALID_IMAGE_NOT_MZ"), + SMB_NTSTATUS_INVALID_IMAGE_PROTECT => Some("STATUS_INVALID_IMAGE_PROTECT"), + SMB_NTSTATUS_INVALID_IMAGE_WIN_16 => Some("STATUS_INVALID_IMAGE_WIN_16"), + SMB_NTSTATUS_LOGON_SERVER_CONFLICT => Some("STATUS_LOGON_SERVER_CONFLICT"), + SMB_NTSTATUS_TIME_DIFFERENCE_AT_DC => Some("STATUS_TIME_DIFFERENCE_AT_DC"), + SMB_NTSTATUS_SYNCHRONIZATION_REQUIRED => Some("STATUS_SYNCHRONIZATION_REQUIRED"), + SMB_NTSTATUS_DLL_NOT_FOUND => Some("STATUS_DLL_NOT_FOUND"), + SMB_NTSTATUS_OPEN_FAILED => Some("STATUS_OPEN_FAILED"), + SMB_NTSTATUS_IO_PRIVILEGE_FAILED => Some("STATUS_IO_PRIVILEGE_FAILED"), + SMB_NTSTATUS_ORDINAL_NOT_FOUND => Some("STATUS_ORDINAL_NOT_FOUND"), + SMB_NTSTATUS_ENTRYPOINT_NOT_FOUND => Some("STATUS_ENTRYPOINT_NOT_FOUND"), + SMB_NTSTATUS_CONTROL_C_EXIT => Some("STATUS_CONTROL_C_EXIT"), + SMB_NTSTATUS_LOCAL_DISCONNECT => Some("STATUS_LOCAL_DISCONNECT"), + SMB_NTSTATUS_REMOTE_DISCONNECT => Some("STATUS_REMOTE_DISCONNECT"), + SMB_NTSTATUS_REMOTE_RESOURCES => Some("STATUS_REMOTE_RESOURCES"), + SMB_NTSTATUS_LINK_FAILED => Some("STATUS_LINK_FAILED"), + SMB_NTSTATUS_LINK_TIMEOUT => Some("STATUS_LINK_TIMEOUT"), + SMB_NTSTATUS_INVALID_CONNECTION => Some("STATUS_INVALID_CONNECTION"), + SMB_NTSTATUS_INVALID_ADDRESS => Some("STATUS_INVALID_ADDRESS"), + SMB_NTSTATUS_DLL_INIT_FAILED => Some("STATUS_DLL_INIT_FAILED"), + SMB_NTSTATUS_MISSING_SYSTEMFILE => Some("STATUS_MISSING_SYSTEMFILE"), + SMB_NTSTATUS_UNHANDLED_EXCEPTION => Some("STATUS_UNHANDLED_EXCEPTION"), + SMB_NTSTATUS_APP_INIT_FAILURE => Some("STATUS_APP_INIT_FAILURE"), + SMB_NTSTATUS_PAGEFILE_CREATE_FAILED => Some("STATUS_PAGEFILE_CREATE_FAILED"), + SMB_NTSTATUS_NO_PAGEFILE => Some("STATUS_NO_PAGEFILE"), + SMB_NTSTATUS_INVALID_LEVEL => Some("STATUS_INVALID_LEVEL"), + SMB_NTSTATUS_WRONG_PASSWORD_CORE => Some("STATUS_WRONG_PASSWORD_CORE"), + SMB_NTSTATUS_ILLEGAL_FLOAT_CONTEXT => Some("STATUS_ILLEGAL_FLOAT_CONTEXT"), + SMB_NTSTATUS_PIPE_BROKEN => Some("STATUS_PIPE_BROKEN"), + SMB_NTSTATUS_REGISTRY_CORRUPT => Some("STATUS_REGISTRY_CORRUPT"), + SMB_NTSTATUS_REGISTRY_IO_FAILED => Some("STATUS_REGISTRY_IO_FAILED"), + SMB_NTSTATUS_NO_EVENT_PAIR => Some("STATUS_NO_EVENT_PAIR"), + SMB_NTSTATUS_UNRECOGNIZED_VOLUME => Some("STATUS_UNRECOGNIZED_VOLUME"), + SMB_NTSTATUS_SERIAL_NO_DEVICE_INITED => Some("STATUS_SERIAL_NO_DEVICE_INITED"), + SMB_NTSTATUS_NO_SUCH_ALIAS => Some("STATUS_NO_SUCH_ALIAS"), + SMB_NTSTATUS_MEMBER_NOT_IN_ALIAS => Some("STATUS_MEMBER_NOT_IN_ALIAS"), + SMB_NTSTATUS_MEMBER_IN_ALIAS => Some("STATUS_MEMBER_IN_ALIAS"), + SMB_NTSTATUS_ALIAS_EXISTS => Some("STATUS_ALIAS_EXISTS"), + SMB_NTSTATUS_LOGON_NOT_GRANTED => Some("STATUS_LOGON_NOT_GRANTED"), + SMB_NTSTATUS_TOO_MANY_SECRETS => Some("STATUS_TOO_MANY_SECRETS"), + SMB_NTSTATUS_SECRET_TOO_LONG => Some("STATUS_SECRET_TOO_LONG"), + SMB_NTSTATUS_INTERNAL_DB_ERROR => Some("STATUS_INTERNAL_DB_ERROR"), + SMB_NTSTATUS_FULLSCREEN_MODE => Some("STATUS_FULLSCREEN_MODE"), + SMB_NTSTATUS_TOO_MANY_CONTEXT_IDS => Some("STATUS_TOO_MANY_CONTEXT_IDS"), + SMB_NTSTATUS_LOGON_TYPE_NOT_GRANTED => Some("STATUS_LOGON_TYPE_NOT_GRANTED"), + SMB_NTSTATUS_NOT_REGISTRY_FILE => Some("STATUS_NOT_REGISTRY_FILE"), + SMB_NTSTATUS_NT_CROSS_ENCRYPTION_REQUIRED => Some("STATUS_NT_CROSS_ENCRYPTION_REQUIRED"), + SMB_NTSTATUS_DOMAIN_CTRLR_CONFIG_ERROR => Some("STATUS_DOMAIN_CTRLR_CONFIG_ERROR"), + SMB_NTSTATUS_FT_MISSING_MEMBER => Some("STATUS_FT_MISSING_MEMBER"), + SMB_NTSTATUS_ILL_FORMED_SERVICE_ENTRY => Some("STATUS_ILL_FORMED_SERVICE_ENTRY"), + SMB_NTSTATUS_ILLEGAL_CHARACTER => Some("STATUS_ILLEGAL_CHARACTER"), + SMB_NTSTATUS_UNMAPPABLE_CHARACTER => Some("STATUS_UNMAPPABLE_CHARACTER"), + SMB_NTSTATUS_UNDEFINED_CHARACTER => Some("STATUS_UNDEFINED_CHARACTER"), + SMB_NTSTATUS_FLOPPY_VOLUME => Some("STATUS_FLOPPY_VOLUME"), + SMB_NTSTATUS_FLOPPY_ID_MARK_NOT_FOUND => Some("STATUS_FLOPPY_ID_MARK_NOT_FOUND"), + SMB_NTSTATUS_FLOPPY_WRONG_CYLINDER => Some("STATUS_FLOPPY_WRONG_CYLINDER"), + SMB_NTSTATUS_FLOPPY_UNKNOWN_ERROR => Some("STATUS_FLOPPY_UNKNOWN_ERROR"), + SMB_NTSTATUS_FLOPPY_BAD_REGISTERS => Some("STATUS_FLOPPY_BAD_REGISTERS"), + SMB_NTSTATUS_DISK_RECALIBRATE_FAILED => Some("STATUS_DISK_RECALIBRATE_FAILED"), + SMB_NTSTATUS_DISK_OPERATION_FAILED => Some("STATUS_DISK_OPERATION_FAILED"), + SMB_NTSTATUS_DISK_RESET_FAILED => Some("STATUS_DISK_RESET_FAILED"), + SMB_NTSTATUS_SHARED_IRQ_BUSY => Some("STATUS_SHARED_IRQ_BUSY"), + SMB_NTSTATUS_FT_ORPHANING => Some("STATUS_FT_ORPHANING"), + SMB_NTSTATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT => { + Some("STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT") + } + SMB_NTSTATUS_PARTITION_FAILURE => Some("STATUS_PARTITION_FAILURE"), + SMB_NTSTATUS_INVALID_BLOCK_LENGTH => Some("STATUS_INVALID_BLOCK_LENGTH"), + SMB_NTSTATUS_DEVICE_NOT_PARTITIONED => Some("STATUS_DEVICE_NOT_PARTITIONED"), + SMB_NTSTATUS_UNABLE_TO_LOCK_MEDIA => Some("STATUS_UNABLE_TO_LOCK_MEDIA"), + SMB_NTSTATUS_UNABLE_TO_UNLOAD_MEDIA => Some("STATUS_UNABLE_TO_UNLOAD_MEDIA"), + SMB_NTSTATUS_EOM_OVERFLOW => Some("STATUS_EOM_OVERFLOW"), + SMB_NTSTATUS_NO_MEDIA => Some("STATUS_NO_MEDIA"), + SMB_NTSTATUS_NO_SUCH_MEMBER => Some("STATUS_NO_SUCH_MEMBER"), + SMB_NTSTATUS_INVALID_MEMBER => Some("STATUS_INVALID_MEMBER"), + SMB_NTSTATUS_KEY_DELETED => Some("STATUS_KEY_DELETED"), + SMB_NTSTATUS_NO_LOG_SPACE => Some("STATUS_NO_LOG_SPACE"), + SMB_NTSTATUS_TOO_MANY_SIDS => Some("STATUS_TOO_MANY_SIDS"), + SMB_NTSTATUS_LM_CROSS_ENCRYPTION_REQUIRED => Some("STATUS_LM_CROSS_ENCRYPTION_REQUIRED"), + SMB_NTSTATUS_KEY_HAS_CHILDREN => Some("STATUS_KEY_HAS_CHILDREN"), + SMB_NTSTATUS_CHILD_MUST_BE_VOLATILE => Some("STATUS_CHILD_MUST_BE_VOLATILE"), + SMB_NTSTATUS_DEVICE_CONFIGURATION_ERROR => Some("STATUS_DEVICE_CONFIGURATION_ERROR"), + SMB_NTSTATUS_DRIVER_INTERNAL_ERROR => Some("STATUS_DRIVER_INTERNAL_ERROR"), + SMB_NTSTATUS_INVALID_DEVICE_STATE => Some("STATUS_INVALID_DEVICE_STATE"), + SMB_NTSTATUS_IO_DEVICE_ERROR => Some("STATUS_IO_DEVICE_ERROR"), + SMB_NTSTATUS_DEVICE_PROTOCOL_ERROR => Some("STATUS_DEVICE_PROTOCOL_ERROR"), + SMB_NTSTATUS_BACKUP_CONTROLLER => Some("STATUS_BACKUP_CONTROLLER"), + SMB_NTSTATUS_LOG_FILE_FULL => Some("STATUS_LOG_FILE_FULL"), + SMB_NTSTATUS_TOO_LATE => Some("STATUS_TOO_LATE"), + SMB_NTSTATUS_NO_TRUST_LSA_SECRET => Some("STATUS_NO_TRUST_LSA_SECRET"), + SMB_NTSTATUS_NO_TRUST_SAM_ACCOUNT => Some("STATUS_NO_TRUST_SAM_ACCOUNT"), + SMB_NTSTATUS_TRUSTED_DOMAIN_FAILURE => Some("STATUS_TRUSTED_DOMAIN_FAILURE"), + SMB_NTSTATUS_TRUSTED_RELATIONSHIP_FAILURE => Some("STATUS_TRUSTED_RELATIONSHIP_FAILURE"), + SMB_NTSTATUS_EVENTLOG_FILE_CORRUPT => Some("STATUS_EVENTLOG_FILE_CORRUPT"), + SMB_NTSTATUS_EVENTLOG_CANT_START => Some("STATUS_EVENTLOG_CANT_START"), + SMB_NTSTATUS_TRUST_FAILURE => Some("STATUS_TRUST_FAILURE"), + SMB_NTSTATUS_MUTANT_LIMIT_EXCEEDED => Some("STATUS_MUTANT_LIMIT_EXCEEDED"), + SMB_NTSTATUS_NETLOGON_NOT_STARTED => Some("STATUS_NETLOGON_NOT_STARTED"), + SMB_NTSTATUS_ACCOUNT_EXPIRED => Some("STATUS_ACCOUNT_EXPIRED"), + SMB_NTSTATUS_POSSIBLE_DEADLOCK => Some("STATUS_POSSIBLE_DEADLOCK"), + SMB_NTSTATUS_NETWORK_CREDENTIAL_CONFLICT => Some("STATUS_NETWORK_CREDENTIAL_CONFLICT"), + SMB_NTSTATUS_REMOTE_SESSION_LIMIT => Some("STATUS_REMOTE_SESSION_LIMIT"), + SMB_NTSTATUS_EVENTLOG_FILE_CHANGED => Some("STATUS_EVENTLOG_FILE_CHANGED"), + SMB_NTSTATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT => { + Some("STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT") + } + SMB_NTSTATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT => { + Some("STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT") + } + SMB_NTSTATUS_NOLOGON_SERVER_TRUST_ACCOUNT => Some("STATUS_NOLOGON_SERVER_TRUST_ACCOUNT"), + SMB_NTSTATUS_DOMAIN_TRUST_INCONSISTENT => Some("STATUS_DOMAIN_TRUST_INCONSISTENT"), + SMB_NTSTATUS_FS_DRIVER_REQUIRED => Some("STATUS_FS_DRIVER_REQUIRED"), + SMB_NTSTATUS_IMAGE_ALREADY_LOADED_AS_DLL => Some("STATUS_IMAGE_ALREADY_LOADED_AS_DLL"), + SMB_NTSTATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING => { + Some("STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING") + } + SMB_NTSTATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME => { + Some("STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME") + } + SMB_NTSTATUS_SECURITY_STREAM_IS_INCONSISTENT => { + Some("STATUS_SECURITY_STREAM_IS_INCONSISTENT") + } + SMB_NTSTATUS_INVALID_LOCK_RANGE => Some("STATUS_INVALID_LOCK_RANGE"), + SMB_NTSTATUS_INVALID_ACE_CONDITION => Some("STATUS_INVALID_ACE_CONDITION"), + SMB_NTSTATUS_IMAGE_SUBSYSTEM_NOT_PRESENT => Some("STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT"), + SMB_NTSTATUS_NOTIFICATION_GUID_ALREADY_DEFINED => { + Some("STATUS_NOTIFICATION_GUID_ALREADY_DEFINED") + } + SMB_NTSTATUS_NETWORK_OPEN_RESTRICTION => Some("STATUS_NETWORK_OPEN_RESTRICTION"), + SMB_NTSTATUS_NO_USER_SESSION_KEY => Some("STATUS_NO_USER_SESSION_KEY"), + SMB_NTSTATUS_USER_SESSION_DELETED => Some("STATUS_USER_SESSION_DELETED"), + SMB_NTSTATUS_RESOURCE_LANG_NOT_FOUND => Some("STATUS_RESOURCE_LANG_NOT_FOUND"), + SMB_NTSTATUS_INSUFF_SERVER_RESOURCES => Some("STATUS_INSUFF_SERVER_RESOURCES"), + SMB_NTSTATUS_INVALID_BUFFER_SIZE => Some("STATUS_INVALID_BUFFER_SIZE"), + SMB_NTSTATUS_INVALID_ADDRESS_COMPONENT => Some("STATUS_INVALID_ADDRESS_COMPONENT"), + SMB_NTSTATUS_INVALID_ADDRESS_WILDCARD => Some("STATUS_INVALID_ADDRESS_WILDCARD"), + SMB_NTSTATUS_TOO_MANY_ADDRESSES => Some("STATUS_TOO_MANY_ADDRESSES"), + SMB_NTSTATUS_ADDRESS_ALREADY_EXISTS => Some("STATUS_ADDRESS_ALREADY_EXISTS"), + SMB_NTSTATUS_ADDRESS_CLOSED => Some("STATUS_ADDRESS_CLOSED"), + SMB_NTSTATUS_CONNECTION_DISCONNECTED => Some("STATUS_CONNECTION_DISCONNECTED"), + SMB_NTSTATUS_CONNECTION_RESET => Some("STATUS_CONNECTION_RESET"), + SMB_NTSTATUS_TOO_MANY_NODES => Some("STATUS_TOO_MANY_NODES"), + SMB_NTSTATUS_TRANSACTION_ABORTED => Some("STATUS_TRANSACTION_ABORTED"), + SMB_NTSTATUS_TRANSACTION_TIMED_OUT => Some("STATUS_TRANSACTION_TIMED_OUT"), + SMB_NTSTATUS_TRANSACTION_NO_RELEASE => Some("STATUS_TRANSACTION_NO_RELEASE"), + SMB_NTSTATUS_TRANSACTION_NO_MATCH => Some("STATUS_TRANSACTION_NO_MATCH"), + SMB_NTSTATUS_TRANSACTION_RESPONDED => Some("STATUS_TRANSACTION_RESPONDED"), + SMB_NTSTATUS_TRANSACTION_INVALID_ID => Some("STATUS_TRANSACTION_INVALID_ID"), + SMB_NTSTATUS_TRANSACTION_INVALID_TYPE => Some("STATUS_TRANSACTION_INVALID_TYPE"), + SMB_NTSTATUS_NOT_SERVER_SESSION => Some("STATUS_NOT_SERVER_SESSION"), + SMB_NTSTATUS_NOT_CLIENT_SESSION => Some("STATUS_NOT_CLIENT_SESSION"), + SMB_NTSTATUS_CANNOT_LOAD_REGISTRY_FILE => Some("STATUS_CANNOT_LOAD_REGISTRY_FILE"), + SMB_NTSTATUS_DEBUG_ATTACH_FAILED => Some("STATUS_DEBUG_ATTACH_FAILED"), + SMB_NTSTATUS_SYSTEM_PROCESS_TERMINATED => Some("STATUS_SYSTEM_PROCESS_TERMINATED"), + SMB_NTSTATUS_DATA_NOT_ACCEPTED => Some("STATUS_DATA_NOT_ACCEPTED"), + SMB_NTSTATUS_NO_BROWSER_SERVERS_FOUND => Some("STATUS_NO_BROWSER_SERVERS_FOUND"), + SMB_NTSTATUS_VDM_HARD_ERROR => Some("STATUS_VDM_HARD_ERROR"), + SMB_NTSTATUS_DRIVER_CANCEL_TIMEOUT => Some("STATUS_DRIVER_CANCEL_TIMEOUT"), + SMB_NTSTATUS_REPLY_MESSAGE_MISMATCH => Some("STATUS_REPLY_MESSAGE_MISMATCH"), + SMB_NTSTATUS_MAPPED_ALIGNMENT => Some("STATUS_MAPPED_ALIGNMENT"), + SMB_NTSTATUS_IMAGE_CHECKSUM_MISMATCH => Some("STATUS_IMAGE_CHECKSUM_MISMATCH"), + SMB_NTSTATUS_LOST_WRITEBEHIND_DATA => Some("STATUS_LOST_WRITEBEHIND_DATA"), + SMB_NTSTATUS_CLIENT_SERVER_PARAMETERS_INVALID => { + Some("STATUS_CLIENT_SERVER_PARAMETERS_INVALID") + } + SMB_NTSTATUS_PASSWORD_MUST_CHANGE => Some("STATUS_PASSWORD_MUST_CHANGE"), + SMB_NTSTATUS_NOT_FOUND => Some("STATUS_NOT_FOUND"), + SMB_NTSTATUS_NOT_TINY_STREAM => Some("STATUS_NOT_TINY_STREAM"), + SMB_NTSTATUS_RECOVERY_FAILURE => Some("STATUS_RECOVERY_FAILURE"), + SMB_NTSTATUS_STACK_OVERFLOW_READ => Some("STATUS_STACK_OVERFLOW_READ"), + SMB_NTSTATUS_FAIL_CHECK => Some("STATUS_FAIL_CHECK"), + SMB_NTSTATUS_DUPLICATE_OBJECTID => Some("STATUS_DUPLICATE_OBJECTID"), + SMB_NTSTATUS_OBJECTID_EXISTS => Some("STATUS_OBJECTID_EXISTS"), + SMB_NTSTATUS_CONVERT_TO_LARGE => Some("STATUS_CONVERT_TO_LARGE"), + SMB_NTSTATUS_RETRY => Some("STATUS_RETRY"), + SMB_NTSTATUS_FOUND_OUT_OF_SCOPE => Some("STATUS_FOUND_OUT_OF_SCOPE"), + SMB_NTSTATUS_ALLOCATE_BUCKET => Some("STATUS_ALLOCATE_BUCKET"), + SMB_NTSTATUS_PROPSET_NOT_FOUND => Some("STATUS_PROPSET_NOT_FOUND"), + SMB_NTSTATUS_MARSHALL_OVERFLOW => Some("STATUS_MARSHALL_OVERFLOW"), + SMB_NTSTATUS_INVALID_VARIANT => Some("STATUS_INVALID_VARIANT"), + SMB_NTSTATUS_DOMAIN_CONTROLLER_NOT_FOUND => Some("STATUS_DOMAIN_CONTROLLER_NOT_FOUND"), + SMB_NTSTATUS_ACCOUNT_LOCKED_OUT => Some("STATUS_ACCOUNT_LOCKED_OUT"), + SMB_NTSTATUS_HANDLE_NOT_CLOSABLE => Some("STATUS_HANDLE_NOT_CLOSABLE"), + SMB_NTSTATUS_CONNECTION_REFUSED => Some("STATUS_CONNECTION_REFUSED"), + SMB_NTSTATUS_GRACEFUL_DISCONNECT => Some("STATUS_GRACEFUL_DISCONNECT"), + SMB_NTSTATUS_ADDRESS_ALREADY_ASSOCIATED => Some("STATUS_ADDRESS_ALREADY_ASSOCIATED"), + SMB_NTSTATUS_ADDRESS_NOT_ASSOCIATED => Some("STATUS_ADDRESS_NOT_ASSOCIATED"), + SMB_NTSTATUS_CONNECTION_INVALID => Some("STATUS_CONNECTION_INVALID"), + SMB_NTSTATUS_CONNECTION_ACTIVE => Some("STATUS_CONNECTION_ACTIVE"), + SMB_NTSTATUS_NETWORK_UNREACHABLE => Some("STATUS_NETWORK_UNREACHABLE"), + SMB_NTSTATUS_HOST_UNREACHABLE => Some("STATUS_HOST_UNREACHABLE"), + SMB_NTSTATUS_PROTOCOL_UNREACHABLE => Some("STATUS_PROTOCOL_UNREACHABLE"), + SMB_NTSTATUS_PORT_UNREACHABLE => Some("STATUS_PORT_UNREACHABLE"), + SMB_NTSTATUS_REQUEST_ABORTED => Some("STATUS_REQUEST_ABORTED"), + SMB_NTSTATUS_CONNECTION_ABORTED => Some("STATUS_CONNECTION_ABORTED"), + SMB_NTSTATUS_BAD_COMPRESSION_BUFFER => Some("STATUS_BAD_COMPRESSION_BUFFER"), + SMB_NTSTATUS_USER_MAPPED_FILE => Some("STATUS_USER_MAPPED_FILE"), + SMB_NTSTATUS_AUDIT_FAILED => Some("STATUS_AUDIT_FAILED"), + SMB_NTSTATUS_TIMER_RESOLUTION_NOT_SET => Some("STATUS_TIMER_RESOLUTION_NOT_SET"), + SMB_NTSTATUS_CONNECTION_COUNT_LIMIT => Some("STATUS_CONNECTION_COUNT_LIMIT"), + SMB_NTSTATUS_LOGIN_TIME_RESTRICTION => Some("STATUS_LOGIN_TIME_RESTRICTION"), + SMB_NTSTATUS_LOGIN_WKSTA_RESTRICTION => Some("STATUS_LOGIN_WKSTA_RESTRICTION"), + SMB_NTSTATUS_IMAGE_MP_UP_MISMATCH => Some("STATUS_IMAGE_MP_UP_MISMATCH"), + SMB_NTSTATUS_INSUFFICIENT_LOGON_INFO => Some("STATUS_INSUFFICIENT_LOGON_INFO"), + SMB_NTSTATUS_BAD_DLL_ENTRYPOINT => Some("STATUS_BAD_DLL_ENTRYPOINT"), + SMB_NTSTATUS_BAD_SERVICE_ENTRYPOINT => Some("STATUS_BAD_SERVICE_ENTRYPOINT"), + SMB_NTSTATUS_LPC_REPLY_LOST => Some("STATUS_LPC_REPLY_LOST"), + SMB_NTSTATUS_IP_ADDRESS_CONFLICT1 => Some("STATUS_IP_ADDRESS_CONFLICT1"), + SMB_NTSTATUS_IP_ADDRESS_CONFLICT2 => Some("STATUS_IP_ADDRESS_CONFLICT2"), + SMB_NTSTATUS_REGISTRY_QUOTA_LIMIT => Some("STATUS_REGISTRY_QUOTA_LIMIT"), + SMB_NTSTATUS_PATH_NOT_COVERED => Some("STATUS_PATH_NOT_COVERED"), + SMB_NTSTATUS_NO_CALLBACK_ACTIVE => Some("STATUS_NO_CALLBACK_ACTIVE"), + SMB_NTSTATUS_LICENSE_QUOTA_EXCEEDED => Some("STATUS_LICENSE_QUOTA_EXCEEDED"), + SMB_NTSTATUS_PWD_TOO_SHORT => Some("STATUS_PWD_TOO_SHORT"), + SMB_NTSTATUS_PWD_TOO_RECENT => Some("STATUS_PWD_TOO_RECENT"), + SMB_NTSTATUS_PWD_HISTORY_CONFLICT => Some("STATUS_PWD_HISTORY_CONFLICT"), + SMB_NTSTATUS_PLUGPLAY_NO_DEVICE => Some("STATUS_PLUGPLAY_NO_DEVICE"), + SMB_NTSTATUS_UNSUPPORTED_COMPRESSION => Some("STATUS_UNSUPPORTED_COMPRESSION"), + SMB_NTSTATUS_INVALID_HW_PROFILE => Some("STATUS_INVALID_HW_PROFILE"), + SMB_NTSTATUS_INVALID_PLUGPLAY_DEVICE_PATH => Some("STATUS_INVALID_PLUGPLAY_DEVICE_PATH"), + SMB_NTSTATUS_DRIVER_ORDINAL_NOT_FOUND => Some("STATUS_DRIVER_ORDINAL_NOT_FOUND"), + SMB_NTSTATUS_DRIVER_ENTRYPOINT_NOT_FOUND => Some("STATUS_DRIVER_ENTRYPOINT_NOT_FOUND"), + SMB_NTSTATUS_RESOURCE_NOT_OWNED => Some("STATUS_RESOURCE_NOT_OWNED"), + SMB_NTSTATUS_TOO_MANY_LINKS => Some("STATUS_TOO_MANY_LINKS"), + SMB_NTSTATUS_QUOTA_LIST_INCONSISTENT => Some("STATUS_QUOTA_LIST_INCONSISTENT"), + SMB_NTSTATUS_FILE_IS_OFFLINE => Some("STATUS_FILE_IS_OFFLINE"), + SMB_NTSTATUS_EVALUATION_EXPIRATION => Some("STATUS_EVALUATION_EXPIRATION"), + SMB_NTSTATUS_ILLEGAL_DLL_RELOCATION => Some("STATUS_ILLEGAL_DLL_RELOCATION"), + SMB_NTSTATUS_LICENSE_VIOLATION => Some("STATUS_LICENSE_VIOLATION"), + SMB_NTSTATUS_DLL_INIT_FAILED_LOGOFF => Some("STATUS_DLL_INIT_FAILED_LOGOFF"), + SMB_NTSTATUS_DRIVER_UNABLE_TO_LOAD => Some("STATUS_DRIVER_UNABLE_TO_LOAD"), + SMB_NTSTATUS_DFS_UNAVAILABLE => Some("STATUS_DFS_UNAVAILABLE"), + SMB_NTSTATUS_VOLUME_DISMOUNTED => Some("STATUS_VOLUME_DISMOUNTED"), + SMB_NTSTATUS_WX86_INTERNAL_ERROR => Some("STATUS_WX86_INTERNAL_ERROR"), + SMB_NTSTATUS_WX86_FLOAT_STACK_CHECK => Some("STATUS_WX86_FLOAT_STACK_CHECK"), + SMB_NTSTATUS_VALIDATE_CONTINUE => Some("STATUS_VALIDATE_CONTINUE"), + SMB_NTSTATUS_NO_MATCH => Some("STATUS_NO_MATCH"), + SMB_NTSTATUS_NO_MORE_MATCHES => Some("STATUS_NO_MORE_MATCHES"), + SMB_NTSTATUS_NOT_A_REPARSE_POINT => Some("STATUS_NOT_A_REPARSE_POINT"), + SMB_NTSTATUS_IO_REPARSE_TAG_INVALID => Some("STATUS_IO_REPARSE_TAG_INVALID"), + SMB_NTSTATUS_IO_REPARSE_TAG_MISMATCH => Some("STATUS_IO_REPARSE_TAG_MISMATCH"), + SMB_NTSTATUS_IO_REPARSE_DATA_INVALID => Some("STATUS_IO_REPARSE_DATA_INVALID"), + SMB_NTSTATUS_IO_REPARSE_TAG_NOT_HANDLED => Some("STATUS_IO_REPARSE_TAG_NOT_HANDLED"), + SMB_NTSTATUS_REPARSE_POINT_NOT_RESOLVED => Some("STATUS_REPARSE_POINT_NOT_RESOLVED"), + SMB_NTSTATUS_DIRECTORY_IS_A_REPARSE_POINT => Some("STATUS_DIRECTORY_IS_A_REPARSE_POINT"), + SMB_NTSTATUS_RANGE_LIST_CONFLICT => Some("STATUS_RANGE_LIST_CONFLICT"), + SMB_NTSTATUS_SOURCE_ELEMENT_EMPTY => Some("STATUS_SOURCE_ELEMENT_EMPTY"), + SMB_NTSTATUS_DESTINATION_ELEMENT_FULL => Some("STATUS_DESTINATION_ELEMENT_FULL"), + SMB_NTSTATUS_ILLEGAL_ELEMENT_ADDRESS => Some("STATUS_ILLEGAL_ELEMENT_ADDRESS"), + SMB_NTSTATUS_MAGAZINE_NOT_PRESENT => Some("STATUS_MAGAZINE_NOT_PRESENT"), + SMB_NTSTATUS_REINITIALIZATION_NEEDED => Some("STATUS_REINITIALIZATION_NEEDED"), + SMB_NTSTATUS_ENCRYPTION_FAILED => Some("STATUS_ENCRYPTION_FAILED"), + SMB_NTSTATUS_DECRYPTION_FAILED => Some("STATUS_DECRYPTION_FAILED"), + SMB_NTSTATUS_RANGE_NOT_FOUND => Some("STATUS_RANGE_NOT_FOUND"), + SMB_NTSTATUS_NO_RECOVERY_POLICY => Some("STATUS_NO_RECOVERY_POLICY"), + SMB_NTSTATUS_NO_EFS => Some("STATUS_NO_EFS"), + SMB_NTSTATUS_WRONG_EFS => Some("STATUS_WRONG_EFS"), + SMB_NTSTATUS_NO_USER_KEYS => Some("STATUS_NO_USER_KEYS"), + SMB_NTSTATUS_FILE_NOT_ENCRYPTED => Some("STATUS_FILE_NOT_ENCRYPTED"), + SMB_NTSTATUS_NOT_EXPORT_FORMAT => Some("STATUS_NOT_EXPORT_FORMAT"), + SMB_NTSTATUS_FILE_ENCRYPTED => Some("STATUS_FILE_ENCRYPTED"), + SMB_NTSTATUS_WMI_GUID_NOT_FOUND => Some("STATUS_WMI_GUID_NOT_FOUND"), + SMB_NTSTATUS_WMI_INSTANCE_NOT_FOUND => Some("STATUS_WMI_INSTANCE_NOT_FOUND"), + SMB_NTSTATUS_WMI_ITEMID_NOT_FOUND => Some("STATUS_WMI_ITEMID_NOT_FOUND"), + SMB_NTSTATUS_WMI_TRY_AGAIN => Some("STATUS_WMI_TRY_AGAIN"), + SMB_NTSTATUS_SHARED_POLICY => Some("STATUS_SHARED_POLICY"), + SMB_NTSTATUS_POLICY_OBJECT_NOT_FOUND => Some("STATUS_POLICY_OBJECT_NOT_FOUND"), + SMB_NTSTATUS_POLICY_ONLY_IN_DS => Some("STATUS_POLICY_ONLY_IN_DS"), + SMB_NTSTATUS_VOLUME_NOT_UPGRADED => Some("STATUS_VOLUME_NOT_UPGRADED"), + SMB_NTSTATUS_REMOTE_STORAGE_NOT_ACTIVE => Some("STATUS_REMOTE_STORAGE_NOT_ACTIVE"), + SMB_NTSTATUS_REMOTE_STORAGE_MEDIA_ERROR => Some("STATUS_REMOTE_STORAGE_MEDIA_ERROR"), + SMB_NTSTATUS_NO_TRACKING_SERVICE => Some("STATUS_NO_TRACKING_SERVICE"), + SMB_NTSTATUS_SERVER_SID_MISMATCH => Some("STATUS_SERVER_SID_MISMATCH"), + SMB_NTSTATUS_DS_NO_ATTRIBUTE_OR_VALUE => Some("STATUS_DS_NO_ATTRIBUTE_OR_VALUE"), + SMB_NTSTATUS_DS_INVALID_ATTRIBUTE_SYNTAX => Some("STATUS_DS_INVALID_ATTRIBUTE_SYNTAX"), + SMB_NTSTATUS_DS_ATTRIBUTE_TYPE_UNDEFINED => Some("STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED"), + SMB_NTSTATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS => Some("STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS"), + SMB_NTSTATUS_DS_BUSY => Some("STATUS_DS_BUSY"), + SMB_NTSTATUS_DS_UNAVAILABLE => Some("STATUS_DS_UNAVAILABLE"), + SMB_NTSTATUS_DS_NO_RIDS_ALLOCATED => Some("STATUS_DS_NO_RIDS_ALLOCATED"), + SMB_NTSTATUS_DS_NO_MORE_RIDS => Some("STATUS_DS_NO_MORE_RIDS"), + SMB_NTSTATUS_DS_INCORRECT_ROLE_OWNER => Some("STATUS_DS_INCORRECT_ROLE_OWNER"), + SMB_NTSTATUS_DS_RIDMGR_INIT_ERROR => Some("STATUS_DS_RIDMGR_INIT_ERROR"), + SMB_NTSTATUS_DS_OBJ_CLASS_VIOLATION => Some("STATUS_DS_OBJ_CLASS_VIOLATION"), + SMB_NTSTATUS_DS_CANT_ON_NON_LEAF => Some("STATUS_DS_CANT_ON_NON_LEAF"), + SMB_NTSTATUS_DS_CANT_ON_RDN => Some("STATUS_DS_CANT_ON_RDN"), + SMB_NTSTATUS_DS_CANT_MOD_OBJ_CLASS => Some("STATUS_DS_CANT_MOD_OBJ_CLASS"), + SMB_NTSTATUS_DS_CROSS_DOM_MOVE_FAILED => Some("STATUS_DS_CROSS_DOM_MOVE_FAILED"), + SMB_NTSTATUS_DS_GC_NOT_AVAILABLE => Some("STATUS_DS_GC_NOT_AVAILABLE"), + SMB_NTSTATUS_DIRECTORY_SERVICE_REQUIRED => Some("STATUS_DIRECTORY_SERVICE_REQUIRED"), + SMB_NTSTATUS_REPARSE_ATTRIBUTE_CONFLICT => Some("STATUS_REPARSE_ATTRIBUTE_CONFLICT"), + SMB_NTSTATUS_CANT_ENABLE_DENY_ONLY => Some("STATUS_CANT_ENABLE_DENY_ONLY"), + SMB_NTSTATUS_FLOAT_MULTIPLE_FAULTS => Some("STATUS_FLOAT_MULTIPLE_FAULTS"), + SMB_NTSTATUS_FLOAT_MULTIPLE_TRAPS => Some("STATUS_FLOAT_MULTIPLE_TRAPS"), + SMB_NTSTATUS_DEVICE_REMOVED => Some("STATUS_DEVICE_REMOVED"), + SMB_NTSTATUS_JOURNAL_DELETE_IN_PROGRESS => Some("STATUS_JOURNAL_DELETE_IN_PROGRESS"), + SMB_NTSTATUS_JOURNAL_NOT_ACTIVE => Some("STATUS_JOURNAL_NOT_ACTIVE"), + SMB_NTSTATUS_NOINTERFACE => Some("STATUS_NOINTERFACE"), + SMB_NTSTATUS_DS_ADMIN_LIMIT_EXCEEDED => Some("STATUS_DS_ADMIN_LIMIT_EXCEEDED"), + SMB_NTSTATUS_DRIVER_FAILED_SLEEP => Some("STATUS_DRIVER_FAILED_SLEEP"), + SMB_NTSTATUS_MUTUAL_AUTHENTICATION_FAILED => Some("STATUS_MUTUAL_AUTHENTICATION_FAILED"), + SMB_NTSTATUS_CORRUPT_SYSTEM_FILE => Some("STATUS_CORRUPT_SYSTEM_FILE"), + SMB_NTSTATUS_DATATYPE_MISALIGNMENT_ERROR => Some("STATUS_DATATYPE_MISALIGNMENT_ERROR"), + SMB_NTSTATUS_WMI_READ_ONLY => Some("STATUS_WMI_READ_ONLY"), + SMB_NTSTATUS_WMI_SET_FAILURE => Some("STATUS_WMI_SET_FAILURE"), + SMB_NTSTATUS_COMMITMENT_MINIMUM => Some("STATUS_COMMITMENT_MINIMUM"), + SMB_NTSTATUS_REG_NAT_CONSUMPTION => Some("STATUS_REG_NAT_CONSUMPTION"), + SMB_NTSTATUS_TRANSPORT_FULL => Some("STATUS_TRANSPORT_FULL"), + SMB_NTSTATUS_DS_SAM_INIT_FAILURE => Some("STATUS_DS_SAM_INIT_FAILURE"), + SMB_NTSTATUS_ONLY_IF_CONNECTED => Some("STATUS_ONLY_IF_CONNECTED"), + SMB_NTSTATUS_DS_SENSITIVE_GROUP_VIOLATION => Some("STATUS_DS_SENSITIVE_GROUP_VIOLATION"), + SMB_NTSTATUS_PNP_RESTART_ENUMERATION => Some("STATUS_PNP_RESTART_ENUMERATION"), + SMB_NTSTATUS_JOURNAL_ENTRY_DELETED => Some("STATUS_JOURNAL_ENTRY_DELETED"), + SMB_NTSTATUS_DS_CANT_MOD_PRIMARYGROUPID => Some("STATUS_DS_CANT_MOD_PRIMARYGROUPID"), + SMB_NTSTATUS_SYSTEM_IMAGE_BAD_SIGNATURE => Some("STATUS_SYSTEM_IMAGE_BAD_SIGNATURE"), + SMB_NTSTATUS_PNP_REBOOT_REQUIRED => Some("STATUS_PNP_REBOOT_REQUIRED"), + SMB_NTSTATUS_POWER_STATE_INVALID => Some("STATUS_POWER_STATE_INVALID"), + SMB_NTSTATUS_DS_INVALID_GROUP_TYPE => Some("STATUS_DS_INVALID_GROUP_TYPE"), + SMB_NTSTATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN => { + Some("STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN") + } + SMB_NTSTATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN => { + Some("STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN") + } + SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER => { + Some("STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER") + } + SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER => { + Some("STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER") + } + SMB_NTSTATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER => { + Some("STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER") + } + SMB_NTSTATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER => { + Some("STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER") + } + SMB_NTSTATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER => { + Some("STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER") + } + SMB_NTSTATUS_DS_HAVE_PRIMARY_MEMBERS => Some("STATUS_DS_HAVE_PRIMARY_MEMBERS"), + SMB_NTSTATUS_WMI_NOT_SUPPORTED => Some("STATUS_WMI_NOT_SUPPORTED"), + SMB_NTSTATUS_INSUFFICIENT_POWER => Some("STATUS_INSUFFICIENT_POWER"), + SMB_NTSTATUS_SAM_NEED_BOOTKEY_PASSWORD => Some("STATUS_SAM_NEED_BOOTKEY_PASSWORD"), + SMB_NTSTATUS_SAM_NEED_BOOTKEY_FLOPPY => Some("STATUS_SAM_NEED_BOOTKEY_FLOPPY"), + SMB_NTSTATUS_DS_CANT_START => Some("STATUS_DS_CANT_START"), + SMB_NTSTATUS_DS_INIT_FAILURE => Some("STATUS_DS_INIT_FAILURE"), + SMB_NTSTATUS_SAM_INIT_FAILURE => Some("STATUS_SAM_INIT_FAILURE"), + SMB_NTSTATUS_DS_GC_REQUIRED => Some("STATUS_DS_GC_REQUIRED"), + SMB_NTSTATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY => Some("STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY"), + SMB_NTSTATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS => Some("STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS"), + SMB_NTSTATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED => { + Some("STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED") + } + SMB_NTSTATUS_CURRENT_DOMAIN_NOT_ALLOWED => Some("STATUS_CURRENT_DOMAIN_NOT_ALLOWED"), + SMB_NTSTATUS_CANNOT_MAKE => Some("STATUS_CANNOT_MAKE"), + SMB_NTSTATUS_SYSTEM_SHUTDOWN => Some("STATUS_SYSTEM_SHUTDOWN"), + SMB_NTSTATUS_DS_INIT_FAILURE_CONSOLE => Some("STATUS_DS_INIT_FAILURE_CONSOLE"), + SMB_NTSTATUS_DS_SAM_INIT_FAILURE_CONSOLE => Some("STATUS_DS_SAM_INIT_FAILURE_CONSOLE"), + SMB_NTSTATUS_UNFINISHED_CONTEXT_DELETED => Some("STATUS_UNFINISHED_CONTEXT_DELETED"), + SMB_NTSTATUS_NO_TGT_REPLY => Some("STATUS_NO_TGT_REPLY"), + SMB_NTSTATUS_OBJECTID_NOT_FOUND => Some("STATUS_OBJECTID_NOT_FOUND"), + SMB_NTSTATUS_NO_IP_ADDRESSES => Some("STATUS_NO_IP_ADDRESSES"), + SMB_NTSTATUS_WRONG_CREDENTIAL_HANDLE => Some("STATUS_WRONG_CREDENTIAL_HANDLE"), + SMB_NTSTATUS_CRYPTO_SYSTEM_INVALID => Some("STATUS_CRYPTO_SYSTEM_INVALID"), + SMB_NTSTATUS_MAX_REFERRALS_EXCEEDED => Some("STATUS_MAX_REFERRALS_EXCEEDED"), + SMB_NTSTATUS_MUST_BE_KDC => Some("STATUS_MUST_BE_KDC"), + SMB_NTSTATUS_STRONG_CRYPTO_NOT_SUPPORTED => Some("STATUS_STRONG_CRYPTO_NOT_SUPPORTED"), + SMB_NTSTATUS_TOO_MANY_PRINCIPALS => Some("STATUS_TOO_MANY_PRINCIPALS"), + SMB_NTSTATUS_NO_PA_DATA => Some("STATUS_NO_PA_DATA"), + SMB_NTSTATUS_PKINIT_NAME_MISMATCH => Some("STATUS_PKINIT_NAME_MISMATCH"), + SMB_NTSTATUS_SMARTCARD_LOGON_REQUIRED => Some("STATUS_SMARTCARD_LOGON_REQUIRED"), + SMB_NTSTATUS_KDC_INVALID_REQUEST => Some("STATUS_KDC_INVALID_REQUEST"), + SMB_NTSTATUS_KDC_UNABLE_TO_REFER => Some("STATUS_KDC_UNABLE_TO_REFER"), + SMB_NTSTATUS_KDC_UNKNOWN_ETYPE => Some("STATUS_KDC_UNKNOWN_ETYPE"), + SMB_NTSTATUS_SHUTDOWN_IN_PROGRESS => Some("STATUS_SHUTDOWN_IN_PROGRESS"), + SMB_NTSTATUS_SERVER_SHUTDOWN_IN_PROGRESS => Some("STATUS_SERVER_SHUTDOWN_IN_PROGRESS"), + SMB_NTSTATUS_NOT_SUPPORTED_ON_SBS => Some("STATUS_NOT_SUPPORTED_ON_SBS"), + SMB_NTSTATUS_WMI_GUID_DISCONNECTED => Some("STATUS_WMI_GUID_DISCONNECTED"), + SMB_NTSTATUS_WMI_ALREADY_DISABLED => Some("STATUS_WMI_ALREADY_DISABLED"), + SMB_NTSTATUS_WMI_ALREADY_ENABLED => Some("STATUS_WMI_ALREADY_ENABLED"), + SMB_NTSTATUS_MFT_TOO_FRAGMENTED => Some("STATUS_MFT_TOO_FRAGMENTED"), + SMB_NTSTATUS_COPY_PROTECTION_FAILURE => Some("STATUS_COPY_PROTECTION_FAILURE"), + SMB_NTSTATUS_CSS_AUTHENTICATION_FAILURE => Some("STATUS_CSS_AUTHENTICATION_FAILURE"), + SMB_NTSTATUS_CSS_KEY_NOT_PRESENT => Some("STATUS_CSS_KEY_NOT_PRESENT"), + SMB_NTSTATUS_CSS_KEY_NOT_ESTABLISHED => Some("STATUS_CSS_KEY_NOT_ESTABLISHED"), + SMB_NTSTATUS_CSS_SCRAMBLED_SECTOR => Some("STATUS_CSS_SCRAMBLED_SECTOR"), + SMB_NTSTATUS_CSS_REGION_MISMATCH => Some("STATUS_CSS_REGION_MISMATCH"), + SMB_NTSTATUS_CSS_RESETS_EXHAUSTED => Some("STATUS_CSS_RESETS_EXHAUSTED"), + SMB_NTSTATUS_PKINIT_FAILURE => Some("STATUS_PKINIT_FAILURE"), + SMB_NTSTATUS_SMARTCARD_SUBSYSTEM_FAILURE => Some("STATUS_SMARTCARD_SUBSYSTEM_FAILURE"), + SMB_NTSTATUS_NO_KERB_KEY => Some("STATUS_NO_KERB_KEY"), + SMB_NTSTATUS_HOST_DOWN => Some("STATUS_HOST_DOWN"), + SMB_NTSTATUS_UNSUPPORTED_PREAUTH => Some("STATUS_UNSUPPORTED_PREAUTH"), + SMB_NTSTATUS_EFS_ALG_BLOB_TOO_BIG => Some("STATUS_EFS_ALG_BLOB_TOO_BIG"), + SMB_NTSTATUS_PORT_NOT_SET => Some("STATUS_PORT_NOT_SET"), + SMB_NTSTATUS_DEBUGGER_INACTIVE => Some("STATUS_DEBUGGER_INACTIVE"), + SMB_NTSTATUS_DS_VERSION_CHECK_FAILURE => Some("STATUS_DS_VERSION_CHECK_FAILURE"), + SMB_NTSTATUS_AUDITING_DISABLED => Some("STATUS_AUDITING_DISABLED"), + SMB_NTSTATUS_PRENT4_MACHINE_ACCOUNT => Some("STATUS_PRENT4_MACHINE_ACCOUNT"), + SMB_NTSTATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER => { + Some("STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER") + } + SMB_NTSTATUS_INVALID_IMAGE_WIN_32 => Some("STATUS_INVALID_IMAGE_WIN_32"), + SMB_NTSTATUS_INVALID_IMAGE_WIN_64 => Some("STATUS_INVALID_IMAGE_WIN_64"), + SMB_NTSTATUS_BAD_BINDINGS => Some("STATUS_BAD_BINDINGS"), + SMB_NTSTATUS_NETWORK_SESSION_EXPIRED => Some("STATUS_NETWORK_SESSION_EXPIRED"), + SMB_NTSTATUS_APPHELP_BLOCK => Some("STATUS_APPHELP_BLOCK"), + SMB_NTSTATUS_ALL_SIDS_FILTERED => Some("STATUS_ALL_SIDS_FILTERED"), + SMB_NTSTATUS_NOT_SAFE_MODE_DRIVER => Some("STATUS_NOT_SAFE_MODE_DRIVER"), + SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT => { + Some("STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT") + } + SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PATH => { + Some("STATUS_ACCESS_DISABLED_BY_POLICY_PATH") + } + SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER => { + Some("STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER") + } + SMB_NTSTATUS_ACCESS_DISABLED_BY_POLICY_OTHER => { + Some("STATUS_ACCESS_DISABLED_BY_POLICY_OTHER") + } + SMB_NTSTATUS_FAILED_DRIVER_ENTRY => Some("STATUS_FAILED_DRIVER_ENTRY"), + SMB_NTSTATUS_DEVICE_ENUMERATION_ERROR => Some("STATUS_DEVICE_ENUMERATION_ERROR"), + SMB_NTSTATUS_MOUNT_POINT_NOT_RESOLVED => Some("STATUS_MOUNT_POINT_NOT_RESOLVED"), + SMB_NTSTATUS_INVALID_DEVICE_OBJECT_PARAMETER => { + Some("STATUS_INVALID_DEVICE_OBJECT_PARAMETER") + } + SMB_NTSTATUS_MCA_OCCURED => Some("STATUS_MCA_OCCURED"), + SMB_NTSTATUS_DRIVER_BLOCKED_CRITICAL => Some("STATUS_DRIVER_BLOCKED_CRITICAL"), + SMB_NTSTATUS_DRIVER_BLOCKED => Some("STATUS_DRIVER_BLOCKED"), + SMB_NTSTATUS_DRIVER_DATABASE_ERROR => Some("STATUS_DRIVER_DATABASE_ERROR"), + SMB_NTSTATUS_SYSTEM_HIVE_TOO_LARGE => Some("STATUS_SYSTEM_HIVE_TOO_LARGE"), + SMB_NTSTATUS_INVALID_IMPORT_OF_NON_DLL => Some("STATUS_INVALID_IMPORT_OF_NON_DLL"), + SMB_NTSTATUS_NO_SECRETS => Some("STATUS_NO_SECRETS"), + SMB_NTSTATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY => { + Some("STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY") + } + SMB_NTSTATUS_FAILED_STACK_SWITCH => Some("STATUS_FAILED_STACK_SWITCH"), + SMB_NTSTATUS_HEAP_CORRUPTION => Some("STATUS_HEAP_CORRUPTION"), + SMB_NTSTATUS_SMARTCARD_WRONG_PIN => Some("STATUS_SMARTCARD_WRONG_PIN"), + SMB_NTSTATUS_SMARTCARD_CARD_BLOCKED => Some("STATUS_SMARTCARD_CARD_BLOCKED"), + SMB_NTSTATUS_SMARTCARD_CARD_NOT_AUTHENTICATED => { + Some("STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED") + } + SMB_NTSTATUS_SMARTCARD_NO_CARD => Some("STATUS_SMARTCARD_NO_CARD"), + SMB_NTSTATUS_SMARTCARD_NO_KEY_CONTAINER => Some("STATUS_SMARTCARD_NO_KEY_CONTAINER"), + SMB_NTSTATUS_SMARTCARD_NO_CERTIFICATE => Some("STATUS_SMARTCARD_NO_CERTIFICATE"), + SMB_NTSTATUS_SMARTCARD_NO_KEYSET => Some("STATUS_SMARTCARD_NO_KEYSET"), + SMB_NTSTATUS_SMARTCARD_IO_ERROR => Some("STATUS_SMARTCARD_IO_ERROR"), + SMB_NTSTATUS_DOWNGRADE_DETECTED => Some("STATUS_DOWNGRADE_DETECTED"), + SMB_NTSTATUS_SMARTCARD_CERT_REVOKED => Some("STATUS_SMARTCARD_CERT_REVOKED"), + SMB_NTSTATUS_ISSUING_CA_UNTRUSTED => Some("STATUS_ISSUING_CA_UNTRUSTED"), + SMB_NTSTATUS_REVOCATION_OFFLINE_C => Some("STATUS_REVOCATION_OFFLINE_C"), + SMB_NTSTATUS_PKINIT_CLIENT_FAILURE => Some("STATUS_PKINIT_CLIENT_FAILURE"), + SMB_NTSTATUS_SMARTCARD_CERT_EXPIRED => Some("STATUS_SMARTCARD_CERT_EXPIRED"), + SMB_NTSTATUS_DRIVER_FAILED_PRIOR_UNLOAD => Some("STATUS_DRIVER_FAILED_PRIOR_UNLOAD"), + SMB_NTSTATUS_SMARTCARD_SILENT_CONTEXT => Some("STATUS_SMARTCARD_SILENT_CONTEXT"), + SMB_NTSTATUS_PER_USER_TRUST_QUOTA_EXCEEDED => Some("STATUS_PER_USER_TRUST_QUOTA_EXCEEDED"), + SMB_NTSTATUS_ALL_USER_TRUST_QUOTA_EXCEEDED => Some("STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED"), + SMB_NTSTATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED => { + Some("STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED") + } + SMB_NTSTATUS_DS_NAME_NOT_UNIQUE => Some("STATUS_DS_NAME_NOT_UNIQUE"), + SMB_NTSTATUS_DS_DUPLICATE_ID_FOUND => Some("STATUS_DS_DUPLICATE_ID_FOUND"), + SMB_NTSTATUS_DS_GROUP_CONVERSION_ERROR => Some("STATUS_DS_GROUP_CONVERSION_ERROR"), + SMB_NTSTATUS_VOLSNAP_PREPARE_HIBERNATE => Some("STATUS_VOLSNAP_PREPARE_HIBERNATE"), + SMB_NTSTATUS_USER2USER_REQUIRED => Some("STATUS_USER2USER_REQUIRED"), + SMB_NTSTATUS_STACK_BUFFER_OVERRUN => Some("STATUS_STACK_BUFFER_OVERRUN"), + SMB_NTSTATUS_NO_S4U_PROT_SUPPORT => Some("STATUS_NO_S4U_PROT_SUPPORT"), + SMB_NTSTATUS_CROSSREALM_DELEGATION_FAILURE => Some("STATUS_CROSSREALM_DELEGATION_FAILURE"), + SMB_NTSTATUS_REVOCATION_OFFLINE_KDC => Some("STATUS_REVOCATION_OFFLINE_KDC"), + SMB_NTSTATUS_ISSUING_CA_UNTRUSTED_KDC => Some("STATUS_ISSUING_CA_UNTRUSTED_KDC"), + SMB_NTSTATUS_KDC_CERT_EXPIRED => Some("STATUS_KDC_CERT_EXPIRED"), + SMB_NTSTATUS_KDC_CERT_REVOKED => Some("STATUS_KDC_CERT_REVOKED"), + SMB_NTSTATUS_PARAMETER_QUOTA_EXCEEDED => Some("STATUS_PARAMETER_QUOTA_EXCEEDED"), + SMB_NTSTATUS_HIBERNATION_FAILURE => Some("STATUS_HIBERNATION_FAILURE"), + SMB_NTSTATUS_DELAY_LOAD_FAILED => Some("STATUS_DELAY_LOAD_FAILED"), + SMB_NTSTATUS_AUTHENTICATION_FIREWALL_FAILED => { + Some("STATUS_AUTHENTICATION_FIREWALL_FAILED") + } + SMB_NTSTATUS_VDM_DISALLOWED => Some("STATUS_VDM_DISALLOWED"), + SMB_NTSTATUS_HUNG_DISPLAY_DRIVER_THREAD => Some("STATUS_HUNG_DISPLAY_DRIVER_THREAD"), + SMB_NTSTATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE => { + Some("STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE") + } + SMB_NTSTATUS_INVALID_CRUNTIME_PARAMETER => Some("STATUS_INVALID_CRUNTIME_PARAMETER"), + SMB_NTSTATUS_NTLM_BLOCKED => Some("STATUS_NTLM_BLOCKED"), + SMB_NTSTATUS_DS_SRC_SID_EXISTS_IN_FOREST => Some("STATUS_DS_SRC_SID_EXISTS_IN_FOREST"), + SMB_NTSTATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST => { + Some("STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST") + } + SMB_NTSTATUS_DS_FLAT_NAME_EXISTS_IN_FOREST => Some("STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST"), + SMB_NTSTATUS_INVALID_USER_PRINCIPAL_NAME => Some("STATUS_INVALID_USER_PRINCIPAL_NAME"), + SMB_NTSTATUS_ASSERTION_FAILURE => Some("STATUS_ASSERTION_FAILURE"), + SMB_NTSTATUS_VERIFIER_STOP => Some("STATUS_VERIFIER_STOP"), + SMB_NTSTATUS_CALLBACK_POP_STACK => Some("STATUS_CALLBACK_POP_STACK"), + SMB_NTSTATUS_INCOMPATIBLE_DRIVER_BLOCKED => Some("STATUS_INCOMPATIBLE_DRIVER_BLOCKED"), + SMB_NTSTATUS_HIVE_UNLOADED => Some("STATUS_HIVE_UNLOADED"), + SMB_NTSTATUS_COMPRESSION_DISABLED => Some("STATUS_COMPRESSION_DISABLED"), + SMB_NTSTATUS_FILE_SYSTEM_LIMITATION => Some("STATUS_FILE_SYSTEM_LIMITATION"), + SMB_NTSTATUS_INVALID_IMAGE_HASH => Some("STATUS_INVALID_IMAGE_HASH"), + SMB_NTSTATUS_NOT_CAPABLE => Some("STATUS_NOT_CAPABLE"), + SMB_NTSTATUS_REQUEST_OUT_OF_SEQUENCE => Some("STATUS_REQUEST_OUT_OF_SEQUENCE"), + SMB_NTSTATUS_IMPLEMENTATION_LIMIT => Some("STATUS_IMPLEMENTATION_LIMIT"), + SMB_NTSTATUS_ELEVATION_REQUIRED => Some("STATUS_ELEVATION_REQUIRED"), + SMB_NTSTATUS_NO_SECURITY_CONTEXT => Some("STATUS_NO_SECURITY_CONTEXT"), + SMB_NTSTATUS_PKU2U_CERT_FAILURE => Some("STATUS_PKU2U_CERT_FAILURE"), + SMB_NTSTATUS_BEYOND_VDL => Some("STATUS_BEYOND_VDL"), + SMB_NTSTATUS_ENCOUNTERED_WRITE_IN_PROGRESS => Some("STATUS_ENCOUNTERED_WRITE_IN_PROGRESS"), + SMB_NTSTATUS_PTE_CHANGED => Some("STATUS_PTE_CHANGED"), + SMB_NTSTATUS_PURGE_FAILED => Some("STATUS_PURGE_FAILED"), + SMB_NTSTATUS_CRED_REQUIRES_CONFIRMATION => Some("STATUS_CRED_REQUIRES_CONFIRMATION"), + SMB_NTSTATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE => { + Some("STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE") + } + SMB_NTSTATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER => { + Some("STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER") + } + SMB_NTSTATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE => { + Some("STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE") + } + SMB_NTSTATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE => { + Some("STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE") + } + SMB_NTSTATUS_CS_ENCRYPTION_FILE_NOT_CSE => Some("STATUS_CS_ENCRYPTION_FILE_NOT_CSE"), + SMB_NTSTATUS_INVALID_LABEL => Some("STATUS_INVALID_LABEL"), + SMB_NTSTATUS_DRIVER_PROCESS_TERMINATED => Some("STATUS_DRIVER_PROCESS_TERMINATED"), + SMB_NTSTATUS_AMBIGUOUS_SYSTEM_DEVICE => Some("STATUS_AMBIGUOUS_SYSTEM_DEVICE"), + SMB_NTSTATUS_SYSTEM_DEVICE_NOT_FOUND => Some("STATUS_SYSTEM_DEVICE_NOT_FOUND"), + SMB_NTSTATUS_RESTART_BOOT_APPLICATION => Some("STATUS_RESTART_BOOT_APPLICATION"), + SMB_NTSTATUS_INSUFFICIENT_NVRAM_RESOURCES => Some("STATUS_INSUFFICIENT_NVRAM_RESOURCES"), + SMB_NTSTATUS_NO_RANGES_PROCESSED => Some("STATUS_NO_RANGES_PROCESSED"), + SMB_NTSTATUS_DEVICE_FEATURE_NOT_SUPPORTED => Some("STATUS_DEVICE_FEATURE_NOT_SUPPORTED"), + SMB_NTSTATUS_DEVICE_UNREACHABLE => Some("STATUS_DEVICE_UNREACHABLE"), + SMB_NTSTATUS_INVALID_TOKEN => Some("STATUS_INVALID_TOKEN"), + SMB_NTSTATUS_SERVER_UNAVAILABLE => Some("STATUS_SERVER_UNAVAILABLE"), + SMB_NTSTATUS_INVALID_TASK_NAME => Some("STATUS_INVALID_TASK_NAME"), + SMB_NTSTATUS_INVALID_TASK_INDEX => Some("STATUS_INVALID_TASK_INDEX"), + SMB_NTSTATUS_THREAD_ALREADY_IN_TASK => Some("STATUS_THREAD_ALREADY_IN_TASK"), + SMB_NTSTATUS_CALLBACK_BYPASS => Some("STATUS_CALLBACK_BYPASS"), + SMB_NTSTATUS_FAIL_FAST_EXCEPTION => Some("STATUS_FAIL_FAST_EXCEPTION"), + SMB_NTSTATUS_IMAGE_CERT_REVOKED => Some("STATUS_IMAGE_CERT_REVOKED"), + SMB_NTSTATUS_PORT_CLOSED => Some("STATUS_PORT_CLOSED"), + SMB_NTSTATUS_MESSAGE_LOST => Some("STATUS_MESSAGE_LOST"), + SMB_NTSTATUS_INVALID_MESSAGE => Some("STATUS_INVALID_MESSAGE"), + SMB_NTSTATUS_REQUEST_CANCELED => Some("STATUS_REQUEST_CANCELED"), + SMB_NTSTATUS_RECURSIVE_DISPATCH => Some("STATUS_RECURSIVE_DISPATCH"), + SMB_NTSTATUS_LPC_RECEIVE_BUFFER_EXPECTED => Some("STATUS_LPC_RECEIVE_BUFFER_EXPECTED"), + SMB_NTSTATUS_LPC_INVALID_CONNECTION_USAGE => Some("STATUS_LPC_INVALID_CONNECTION_USAGE"), + SMB_NTSTATUS_LPC_REQUESTS_NOT_ALLOWED => Some("STATUS_LPC_REQUESTS_NOT_ALLOWED"), + SMB_NTSTATUS_RESOURCE_IN_USE => Some("STATUS_RESOURCE_IN_USE"), + SMB_NTSTATUS_HARDWARE_MEMORY_ERROR => Some("STATUS_HARDWARE_MEMORY_ERROR"), + SMB_NTSTATUS_THREADPOOL_HANDLE_EXCEPTION => Some("STATUS_THREADPOOL_HANDLE_EXCEPTION"), + SMB_NTSTATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED => { + Some("STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED") + } + SMB_NTSTATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED => { + Some("STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED") + } + SMB_NTSTATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED => { + Some("STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED") + } + SMB_NTSTATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED => { + Some("STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED") + } + SMB_NTSTATUS_THREADPOOL_RELEASED_DURING_OPERATION => { + Some("STATUS_THREADPOOL_RELEASED_DURING_OPERATION") + } + SMB_NTSTATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING => { + Some("STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING") + } + SMB_NTSTATUS_APC_RETURNED_WHILE_IMPERSONATING => { + Some("STATUS_APC_RETURNED_WHILE_IMPERSONATING") + } + SMB_NTSTATUS_PROCESS_IS_PROTECTED => Some("STATUS_PROCESS_IS_PROTECTED"), + SMB_NTSTATUS_MCA_EXCEPTION => Some("STATUS_MCA_EXCEPTION"), + SMB_NTSTATUS_CERTIFICATE_MAPPING_NOT_UNIQUE => { + Some("STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE") + } + SMB_NTSTATUS_SYMLINK_CLASS_DISABLED => Some("STATUS_SYMLINK_CLASS_DISABLED"), + SMB_NTSTATUS_INVALID_IDN_NORMALIZATION => Some("STATUS_INVALID_IDN_NORMALIZATION"), + SMB_NTSTATUS_NO_UNICODE_TRANSLATION => Some("STATUS_NO_UNICODE_TRANSLATION"), + SMB_NTSTATUS_ALREADY_REGISTERED => Some("STATUS_ALREADY_REGISTERED"), + SMB_NTSTATUS_CONTEXT_MISMATCH => Some("STATUS_CONTEXT_MISMATCH"), + SMB_NTSTATUS_PORT_ALREADY_HAS_COMPLETION_LIST => { + Some("STATUS_PORT_ALREADY_HAS_COMPLETION_LIST") + } + SMB_NTSTATUS_CALLBACK_RETURNED_THREAD_PRIORITY => { + Some("STATUS_CALLBACK_RETURNED_THREAD_PRIORITY") + } + SMB_NTSTATUS_INVALID_THREAD => Some("STATUS_INVALID_THREAD"), + SMB_NTSTATUS_CALLBACK_RETURNED_TRANSACTION => Some("STATUS_CALLBACK_RETURNED_TRANSACTION"), + SMB_NTSTATUS_CALLBACK_RETURNED_LDR_LOCK => Some("STATUS_CALLBACK_RETURNED_LDR_LOCK"), + SMB_NTSTATUS_CALLBACK_RETURNED_LANG => Some("STATUS_CALLBACK_RETURNED_LANG"), + SMB_NTSTATUS_CALLBACK_RETURNED_PRI_BACK => Some("STATUS_CALLBACK_RETURNED_PRI_BACK"), + SMB_NTSTATUS_DISK_REPAIR_DISABLED => Some("STATUS_DISK_REPAIR_DISABLED"), + SMB_NTSTATUS_DS_DOMAIN_RENAME_IN_PROGRESS => Some("STATUS_DS_DOMAIN_RENAME_IN_PROGRESS"), + SMB_NTSTATUS_DISK_QUOTA_EXCEEDED => Some("STATUS_DISK_QUOTA_EXCEEDED"), + SMB_NTSTATUS_CONTENT_BLOCKED => Some("STATUS_CONTENT_BLOCKED"), + SMB_NTSTATUS_BAD_CLUSTERS => Some("STATUS_BAD_CLUSTERS"), + SMB_NTSTATUS_VOLUME_DIRTY => Some("STATUS_VOLUME_DIRTY"), + SMB_NTSTATUS_FILE_CHECKED_OUT => Some("STATUS_FILE_CHECKED_OUT"), + SMB_NTSTATUS_CHECKOUT_REQUIRED => Some("STATUS_CHECKOUT_REQUIRED"), + SMB_NTSTATUS_BAD_FILE_TYPE => Some("STATUS_BAD_FILE_TYPE"), + SMB_NTSTATUS_FILE_TOO_LARGE => Some("STATUS_FILE_TOO_LARGE"), + SMB_NTSTATUS_FORMS_AUTH_REQUIRED => Some("STATUS_FORMS_AUTH_REQUIRED"), + SMB_NTSTATUS_VIRUS_INFECTED => Some("STATUS_VIRUS_INFECTED"), + SMB_NTSTATUS_VIRUS_DELETED => Some("STATUS_VIRUS_DELETED"), + SMB_NTSTATUS_BAD_MCFG_TABLE => Some("STATUS_BAD_MCFG_TABLE"), + SMB_NTSTATUS_CANNOT_BREAK_OPLOCK => Some("STATUS_CANNOT_BREAK_OPLOCK"), + SMB_NTSTATUS_WOW_ASSERTION => Some("STATUS_WOW_ASSERTION"), + SMB_NTSTATUS_INVALID_SIGNATURE => Some("STATUS_INVALID_SIGNATURE"), + SMB_NTSTATUS_HMAC_NOT_SUPPORTED => Some("STATUS_HMAC_NOT_SUPPORTED"), + SMB_NTSTATUS_IPSEC_QUEUE_OVERFLOW => Some("STATUS_IPSEC_QUEUE_OVERFLOW"), + SMB_NTSTATUS_ND_QUEUE_OVERFLOW => Some("STATUS_ND_QUEUE_OVERFLOW"), + SMB_NTSTATUS_HOPLIMIT_EXCEEDED => Some("STATUS_HOPLIMIT_EXCEEDED"), + SMB_NTSTATUS_PROTOCOL_NOT_SUPPORTED => Some("STATUS_PROTOCOL_NOT_SUPPORTED"), + SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED => { + Some("STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED") + } + SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR => { + Some("STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR") + } + SMB_NTSTATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR => { + Some("STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR") + } + SMB_NTSTATUS_XML_PARSE_ERROR => Some("STATUS_XML_PARSE_ERROR"), + SMB_NTSTATUS_XMLDSIG_ERROR => Some("STATUS_XMLDSIG_ERROR"), + SMB_NTSTATUS_WRONG_COMPARTMENT => Some("STATUS_WRONG_COMPARTMENT"), + SMB_NTSTATUS_AUTHIP_FAILURE => Some("STATUS_AUTHIP_FAILURE"), + SMB_NTSTATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS => { + Some("STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS") + } + SMB_NTSTATUS_DS_OID_NOT_FOUND => Some("STATUS_DS_OID_NOT_FOUND"), + SMB_NTSTATUS_HASH_NOT_SUPPORTED => Some("STATUS_HASH_NOT_SUPPORTED"), + SMB_NTSTATUS_HASH_NOT_PRESENT => Some("STATUS_HASH_NOT_PRESENT"), + SMB_NTSTATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED => { + Some("STATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED") + } + SMB_NTSTATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED => { + Some("STATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED") + } + SMB_NTSTATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED => { + Some("STATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED") + } + SMB_NTSTATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED => { + Some("STATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED") + } + SMB_NTDBG_NO_STATE_CHANGE => Some("DBG_NO_STATE_CHANGE"), + SMB_NTDBG_APP_NOT_IDLE => Some("DBG_APP_NOT_IDLE"), + SMB_NTRPC_NT_INVALID_STRING_BINDING => Some("RPC_NT_INVALID_STRING_BINDING"), + SMB_NTRPC_NT_WRONG_KIND_OF_BINDING => Some("RPC_NT_WRONG_KIND_OF_BINDING"), + SMB_NTRPC_NT_INVALID_BINDING => Some("RPC_NT_INVALID_BINDING"), + SMB_NTRPC_NT_PROTSEQ_NOT_SUPPORTED => Some("RPC_NT_PROTSEQ_NOT_SUPPORTED"), + SMB_NTRPC_NT_INVALID_RPC_PROTSEQ => Some("RPC_NT_INVALID_RPC_PROTSEQ"), + SMB_NTRPC_NT_INVALID_STRING_UUID => Some("RPC_NT_INVALID_STRING_UUID"), + SMB_NTRPC_NT_INVALID_ENDPOINT_FORMAT => Some("RPC_NT_INVALID_ENDPOINT_FORMAT"), + SMB_NTRPC_NT_INVALID_NET_ADDR => Some("RPC_NT_INVALID_NET_ADDR"), + SMB_NTRPC_NT_NO_ENDPOINT_FOUND => Some("RPC_NT_NO_ENDPOINT_FOUND"), + SMB_NTRPC_NT_INVALID_TIMEOUT => Some("RPC_NT_INVALID_TIMEOUT"), + SMB_NTRPC_NT_OBJECT_NOT_FOUND => Some("RPC_NT_OBJECT_NOT_FOUND"), + SMB_NTRPC_NT_ALREADY_REGISTERED => Some("RPC_NT_ALREADY_REGISTERED"), + SMB_NTRPC_NT_TYPE_ALREADY_REGISTERED => Some("RPC_NT_TYPE_ALREADY_REGISTERED"), + SMB_NTRPC_NT_ALREADY_LISTENING => Some("RPC_NT_ALREADY_LISTENING"), + SMB_NTRPC_NT_NO_PROTSEQS_REGISTERED => Some("RPC_NT_NO_PROTSEQS_REGISTERED"), + SMB_NTRPC_NT_NOT_LISTENING => Some("RPC_NT_NOT_LISTENING"), + SMB_NTRPC_NT_UNKNOWN_MGR_TYPE => Some("RPC_NT_UNKNOWN_MGR_TYPE"), + SMB_NTRPC_NT_UNKNOWN_IF => Some("RPC_NT_UNKNOWN_IF"), + SMB_NTRPC_NT_NO_BINDINGS => Some("RPC_NT_NO_BINDINGS"), + SMB_NTRPC_NT_NO_PROTSEQS => Some("RPC_NT_NO_PROTSEQS"), + SMB_NTRPC_NT_CANT_CREATE_ENDPOINT => Some("RPC_NT_CANT_CREATE_ENDPOINT"), + SMB_NTRPC_NT_OUT_OF_RESOURCES => Some("RPC_NT_OUT_OF_RESOURCES"), + SMB_NTRPC_NT_SERVER_UNAVAILABLE => Some("RPC_NT_SERVER_UNAVAILABLE"), + SMB_NTRPC_NT_SERVER_TOO_BUSY => Some("RPC_NT_SERVER_TOO_BUSY"), + SMB_NTRPC_NT_INVALID_NETWORK_OPTIONS => Some("RPC_NT_INVALID_NETWORK_OPTIONS"), + SMB_NTRPC_NT_NO_CALL_ACTIVE => Some("RPC_NT_NO_CALL_ACTIVE"), + SMB_NTRPC_NT_CALL_FAILED => Some("RPC_NT_CALL_FAILED"), + SMB_NTRPC_NT_CALL_FAILED_DNE => Some("RPC_NT_CALL_FAILED_DNE"), + SMB_NTRPC_NT_PROTOCOL_ERROR => Some("RPC_NT_PROTOCOL_ERROR"), + SMB_NTRPC_NT_UNSUPPORTED_TRANS_SYN => Some("RPC_NT_UNSUPPORTED_TRANS_SYN"), + SMB_NTRPC_NT_UNSUPPORTED_TYPE => Some("RPC_NT_UNSUPPORTED_TYPE"), + SMB_NTRPC_NT_INVALID_TAG => Some("RPC_NT_INVALID_TAG"), + SMB_NTRPC_NT_INVALID_BOUND => Some("RPC_NT_INVALID_BOUND"), + SMB_NTRPC_NT_NO_ENTRY_NAME => Some("RPC_NT_NO_ENTRY_NAME"), + SMB_NTRPC_NT_INVALID_NAME_SYNTAX => Some("RPC_NT_INVALID_NAME_SYNTAX"), + SMB_NTRPC_NT_UNSUPPORTED_NAME_SYNTAX => Some("RPC_NT_UNSUPPORTED_NAME_SYNTAX"), + SMB_NTRPC_NT_UUID_NO_ADDRESS => Some("RPC_NT_UUID_NO_ADDRESS"), + SMB_NTRPC_NT_DUPLICATE_ENDPOINT => Some("RPC_NT_DUPLICATE_ENDPOINT"), + SMB_NTRPC_NT_UNKNOWN_AUTHN_TYPE => Some("RPC_NT_UNKNOWN_AUTHN_TYPE"), + SMB_NTRPC_NT_MAX_CALLS_TOO_SMALL => Some("RPC_NT_MAX_CALLS_TOO_SMALL"), + SMB_NTRPC_NT_STRING_TOO_LONG => Some("RPC_NT_STRING_TOO_LONG"), + SMB_NTRPC_NT_PROTSEQ_NOT_FOUND => Some("RPC_NT_PROTSEQ_NOT_FOUND"), + SMB_NTRPC_NT_PROCNUM_OUT_OF_RANGE => Some("RPC_NT_PROCNUM_OUT_OF_RANGE"), + SMB_NTRPC_NT_BINDING_HAS_NO_AUTH => Some("RPC_NT_BINDING_HAS_NO_AUTH"), + SMB_NTRPC_NT_UNKNOWN_AUTHN_SERVICE => Some("RPC_NT_UNKNOWN_AUTHN_SERVICE"), + SMB_NTRPC_NT_UNKNOWN_AUTHN_LEVEL => Some("RPC_NT_UNKNOWN_AUTHN_LEVEL"), + SMB_NTRPC_NT_INVALID_AUTH_IDENTITY => Some("RPC_NT_INVALID_AUTH_IDENTITY"), + SMB_NTRPC_NT_UNKNOWN_AUTHZ_SERVICE => Some("RPC_NT_UNKNOWN_AUTHZ_SERVICE"), + SMB_NTEPT_NT_INVALID_ENTRY => Some("EPT_NT_INVALID_ENTRY"), + SMB_NTEPT_NT_CANT_PERFORM_OP => Some("EPT_NT_CANT_PERFORM_OP"), + SMB_NTEPT_NT_NOT_REGISTERED => Some("EPT_NT_NOT_REGISTERED"), + SMB_NTRPC_NT_NOTHING_TO_EXPORT => Some("RPC_NT_NOTHING_TO_EXPORT"), + SMB_NTRPC_NT_INCOMPLETE_NAME => Some("RPC_NT_INCOMPLETE_NAME"), + SMB_NTRPC_NT_INVALID_VERS_OPTION => Some("RPC_NT_INVALID_VERS_OPTION"), + SMB_NTRPC_NT_NO_MORE_MEMBERS => Some("RPC_NT_NO_MORE_MEMBERS"), + SMB_NTRPC_NT_NOT_ALL_OBJS_UNEXPORTED => Some("RPC_NT_NOT_ALL_OBJS_UNEXPORTED"), + SMB_NTRPC_NT_INTERFACE_NOT_FOUND => Some("RPC_NT_INTERFACE_NOT_FOUND"), + SMB_NTRPC_NT_ENTRY_ALREADY_EXISTS => Some("RPC_NT_ENTRY_ALREADY_EXISTS"), + SMB_NTRPC_NT_ENTRY_NOT_FOUND => Some("RPC_NT_ENTRY_NOT_FOUND"), + SMB_NTRPC_NT_NAME_SERVICE_UNAVAILABLE => Some("RPC_NT_NAME_SERVICE_UNAVAILABLE"), + SMB_NTRPC_NT_INVALID_NAF_ID => Some("RPC_NT_INVALID_NAF_ID"), + SMB_NTRPC_NT_CANNOT_SUPPORT => Some("RPC_NT_CANNOT_SUPPORT"), + SMB_NTRPC_NT_NO_CONTEXT_AVAILABLE => Some("RPC_NT_NO_CONTEXT_AVAILABLE"), + SMB_NTRPC_NT_INTERNAL_ERROR => Some("RPC_NT_INTERNAL_ERROR"), + SMB_NTRPC_NT_ZERO_DIVIDE => Some("RPC_NT_ZERO_DIVIDE"), + SMB_NTRPC_NT_ADDRESS_ERROR => Some("RPC_NT_ADDRESS_ERROR"), + SMB_NTRPC_NT_FP_DIV_ZERO => Some("RPC_NT_FP_DIV_ZERO"), + SMB_NTRPC_NT_FP_UNDERFLOW => Some("RPC_NT_FP_UNDERFLOW"), + SMB_NTRPC_NT_FP_OVERFLOW => Some("RPC_NT_FP_OVERFLOW"), + SMB_NTRPC_NT_CALL_IN_PROGRESS => Some("RPC_NT_CALL_IN_PROGRESS"), + SMB_NTRPC_NT_NO_MORE_BINDINGS => Some("RPC_NT_NO_MORE_BINDINGS"), + SMB_NTRPC_NT_GROUP_MEMBER_NOT_FOUND => Some("RPC_NT_GROUP_MEMBER_NOT_FOUND"), + SMB_NTEPT_NT_CANT_CREATE => Some("EPT_NT_CANT_CREATE"), + SMB_NTRPC_NT_INVALID_OBJECT => Some("RPC_NT_INVALID_OBJECT"), + SMB_NTRPC_NT_NO_INTERFACES => Some("RPC_NT_NO_INTERFACES"), + SMB_NTRPC_NT_CALL_CANCELLED => Some("RPC_NT_CALL_CANCELLED"), + SMB_NTRPC_NT_BINDING_INCOMPLETE => Some("RPC_NT_BINDING_INCOMPLETE"), + SMB_NTRPC_NT_COMM_FAILURE => Some("RPC_NT_COMM_FAILURE"), + SMB_NTRPC_NT_UNSUPPORTED_AUTHN_LEVEL => Some("RPC_NT_UNSUPPORTED_AUTHN_LEVEL"), + SMB_NTRPC_NT_NO_PRINC_NAME => Some("RPC_NT_NO_PRINC_NAME"), + SMB_NTRPC_NT_NOT_RPC_ERROR => Some("RPC_NT_NOT_RPC_ERROR"), + SMB_NTRPC_NT_SEC_PKG_ERROR => Some("RPC_NT_SEC_PKG_ERROR"), + SMB_NTRPC_NT_NOT_CANCELLED => Some("RPC_NT_NOT_CANCELLED"), + SMB_NTRPC_NT_INVALID_ASYNC_HANDLE => Some("RPC_NT_INVALID_ASYNC_HANDLE"), + SMB_NTRPC_NT_INVALID_ASYNC_CALL => Some("RPC_NT_INVALID_ASYNC_CALL"), + SMB_NTRPC_NT_PROXY_ACCESS_DENIED => Some("RPC_NT_PROXY_ACCESS_DENIED"), + SMB_NTRPC_NT_NO_MORE_ENTRIES => Some("RPC_NT_NO_MORE_ENTRIES"), + SMB_NTRPC_NT_SS_CHAR_TRANS_OPEN_FAIL => Some("RPC_NT_SS_CHAR_TRANS_OPEN_FAIL"), + SMB_NTRPC_NT_SS_CHAR_TRANS_SHORT_FILE => Some("RPC_NT_SS_CHAR_TRANS_SHORT_FILE"), + SMB_NTRPC_NT_SS_IN_NULL_CONTEXT => Some("RPC_NT_SS_IN_NULL_CONTEXT"), + SMB_NTRPC_NT_SS_CONTEXT_MISMATCH => Some("RPC_NT_SS_CONTEXT_MISMATCH"), + SMB_NTRPC_NT_SS_CONTEXT_DAMAGED => Some("RPC_NT_SS_CONTEXT_DAMAGED"), + SMB_NTRPC_NT_SS_HANDLES_MISMATCH => Some("RPC_NT_SS_HANDLES_MISMATCH"), + SMB_NTRPC_NT_SS_CANNOT_GET_CALL_HANDLE => Some("RPC_NT_SS_CANNOT_GET_CALL_HANDLE"), + SMB_NTRPC_NT_NULL_REF_POINTER => Some("RPC_NT_NULL_REF_POINTER"), + SMB_NTRPC_NT_ENUM_VALUE_OUT_OF_RANGE => Some("RPC_NT_ENUM_VALUE_OUT_OF_RANGE"), + SMB_NTRPC_NT_BYTE_COUNT_TOO_SMALL => Some("RPC_NT_BYTE_COUNT_TOO_SMALL"), + SMB_NTRPC_NT_BAD_STUB_DATA => Some("RPC_NT_BAD_STUB_DATA"), + SMB_NTRPC_NT_INVALID_ES_ACTION => Some("RPC_NT_INVALID_ES_ACTION"), + SMB_NTRPC_NT_WRONG_ES_VERSION => Some("RPC_NT_WRONG_ES_VERSION"), + SMB_NTRPC_NT_WRONG_STUB_VERSION => Some("RPC_NT_WRONG_STUB_VERSION"), + SMB_NTRPC_NT_INVALID_PIPE_OBJECT => Some("RPC_NT_INVALID_PIPE_OBJECT"), + SMB_NTRPC_NT_INVALID_PIPE_OPERATION => Some("RPC_NT_INVALID_PIPE_OPERATION"), + SMB_NTRPC_NT_WRONG_PIPE_VERSION => Some("RPC_NT_WRONG_PIPE_VERSION"), + SMB_NTRPC_NT_PIPE_CLOSED => Some("RPC_NT_PIPE_CLOSED"), + SMB_NTRPC_NT_PIPE_DISCIPLINE_ERROR => Some("RPC_NT_PIPE_DISCIPLINE_ERROR"), + SMB_NTRPC_NT_PIPE_EMPTY => Some("RPC_NT_PIPE_EMPTY"), + SMB_NTSTATUS_PNP_BAD_MPS_TABLE => Some("STATUS_PNP_BAD_MPS_TABLE"), + SMB_NTSTATUS_PNP_TRANSLATION_FAILED => Some("STATUS_PNP_TRANSLATION_FAILED"), + SMB_NTSTATUS_PNP_IRQ_TRANSLATION_FAILED => Some("STATUS_PNP_IRQ_TRANSLATION_FAILED"), + SMB_NTSTATUS_PNP_INVALID_ID => Some("STATUS_PNP_INVALID_ID"), + SMB_NTSTATUS_IO_REISSUE_AS_CACHED => Some("STATUS_IO_REISSUE_AS_CACHED"), + SMB_NTSTATUS_CTX_WINSTATION_NAME_INVALID => Some("STATUS_CTX_WINSTATION_NAME_INVALID"), + SMB_NTSTATUS_CTX_INVALID_PD => Some("STATUS_CTX_INVALID_PD"), + SMB_NTSTATUS_CTX_PD_NOT_FOUND => Some("STATUS_CTX_PD_NOT_FOUND"), + SMB_NTSTATUS_CTX_CLOSE_PENDING => Some("STATUS_CTX_CLOSE_PENDING"), + SMB_NTSTATUS_CTX_NO_OUTBUF => Some("STATUS_CTX_NO_OUTBUF"), + SMB_NTSTATUS_CTX_MODEM_INF_NOT_FOUND => Some("STATUS_CTX_MODEM_INF_NOT_FOUND"), + SMB_NTSTATUS_CTX_INVALID_MODEMNAME => Some("STATUS_CTX_INVALID_MODEMNAME"), + SMB_NTSTATUS_CTX_RESPONSE_ERROR => Some("STATUS_CTX_RESPONSE_ERROR"), + SMB_NTSTATUS_CTX_MODEM_RESPONSE_TIMEOUT => Some("STATUS_CTX_MODEM_RESPONSE_TIMEOUT"), + SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_CARRIER => Some("STATUS_CTX_MODEM_RESPONSE_NO_CARRIER"), + SMB_NTSTATUS_CTX_MODEM_RESPONSE_NO_DIALTONE => { + Some("STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE") + } + SMB_NTSTATUS_CTX_MODEM_RESPONSE_BUSY => Some("STATUS_CTX_MODEM_RESPONSE_BUSY"), + SMB_NTSTATUS_CTX_MODEM_RESPONSE_VOICE => Some("STATUS_CTX_MODEM_RESPONSE_VOICE"), + SMB_NTSTATUS_CTX_TD_ERROR => Some("STATUS_CTX_TD_ERROR"), + SMB_NTSTATUS_CTX_LICENSE_CLIENT_INVALID => Some("STATUS_CTX_LICENSE_CLIENT_INVALID"), + SMB_NTSTATUS_CTX_LICENSE_NOT_AVAILABLE => Some("STATUS_CTX_LICENSE_NOT_AVAILABLE"), + SMB_NTSTATUS_CTX_LICENSE_EXPIRED => Some("STATUS_CTX_LICENSE_EXPIRED"), + SMB_NTSTATUS_CTX_WINSTATION_NOT_FOUND => Some("STATUS_CTX_WINSTATION_NOT_FOUND"), + SMB_NTSTATUS_CTX_WINSTATION_NAME_COLLISION => Some("STATUS_CTX_WINSTATION_NAME_COLLISION"), + SMB_NTSTATUS_CTX_WINSTATION_BUSY => Some("STATUS_CTX_WINSTATION_BUSY"), + SMB_NTSTATUS_CTX_BAD_VIDEO_MODE => Some("STATUS_CTX_BAD_VIDEO_MODE"), + SMB_NTSTATUS_CTX_GRAPHICS_INVALID => Some("STATUS_CTX_GRAPHICS_INVALID"), + SMB_NTSTATUS_CTX_NOT_CONSOLE => Some("STATUS_CTX_NOT_CONSOLE"), + SMB_NTSTATUS_CTX_CLIENT_QUERY_TIMEOUT => Some("STATUS_CTX_CLIENT_QUERY_TIMEOUT"), + SMB_NTSTATUS_CTX_CONSOLE_DISCONNECT => Some("STATUS_CTX_CONSOLE_DISCONNECT"), + SMB_NTSTATUS_CTX_CONSOLE_CONNECT => Some("STATUS_CTX_CONSOLE_CONNECT"), + SMB_NTSTATUS_CTX_SHADOW_DENIED => Some("STATUS_CTX_SHADOW_DENIED"), + SMB_NTSTATUS_CTX_WINSTATION_ACCESS_DENIED => Some("STATUS_CTX_WINSTATION_ACCESS_DENIED"), + SMB_NTSTATUS_CTX_INVALID_WD => Some("STATUS_CTX_INVALID_WD"), + SMB_NTSTATUS_CTX_WD_NOT_FOUND => Some("STATUS_CTX_WD_NOT_FOUND"), + SMB_NTSTATUS_CTX_SHADOW_INVALID => Some("STATUS_CTX_SHADOW_INVALID"), + SMB_NTSTATUS_CTX_SHADOW_DISABLED => Some("STATUS_CTX_SHADOW_DISABLED"), + SMB_NTSTATUS_RDP_PROTOCOL_ERROR => Some("STATUS_RDP_PROTOCOL_ERROR"), + SMB_NTSTATUS_CTX_CLIENT_LICENSE_NOT_SET => Some("STATUS_CTX_CLIENT_LICENSE_NOT_SET"), + SMB_NTSTATUS_CTX_CLIENT_LICENSE_IN_USE => Some("STATUS_CTX_CLIENT_LICENSE_IN_USE"), + SMB_NTSTATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE => { + Some("STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE") + } + SMB_NTSTATUS_CTX_SHADOW_NOT_RUNNING => Some("STATUS_CTX_SHADOW_NOT_RUNNING"), + SMB_NTSTATUS_CTX_LOGON_DISABLED => Some("STATUS_CTX_LOGON_DISABLED"), + SMB_NTSTATUS_CTX_SECURITY_LAYER_ERROR => Some("STATUS_CTX_SECURITY_LAYER_ERROR"), + SMB_NTSTATUS_TS_INCOMPATIBLE_SESSIONS => Some("STATUS_TS_INCOMPATIBLE_SESSIONS"), + SMB_NTSTATUS_MUI_FILE_NOT_FOUND => Some("STATUS_MUI_FILE_NOT_FOUND"), + SMB_NTSTATUS_MUI_INVALID_FILE => Some("STATUS_MUI_INVALID_FILE"), + SMB_NTSTATUS_MUI_INVALID_RC_CONFIG => Some("STATUS_MUI_INVALID_RC_CONFIG"), + SMB_NTSTATUS_MUI_INVALID_LOCALE_NAME => Some("STATUS_MUI_INVALID_LOCALE_NAME"), + SMB_NTSTATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME => { + Some("STATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME") + } + SMB_NTSTATUS_MUI_FILE_NOT_LOADED => Some("STATUS_MUI_FILE_NOT_LOADED"), + SMB_NTSTATUS_RESOURCE_ENUM_USER_STOP => Some("STATUS_RESOURCE_ENUM_USER_STOP"), + SMB_NTSTATUS_CLUSTER_INVALID_NODE => Some("STATUS_CLUSTER_INVALID_NODE"), + SMB_NTSTATUS_CLUSTER_NODE_EXISTS => Some("STATUS_CLUSTER_NODE_EXISTS"), + SMB_NTSTATUS_CLUSTER_JOIN_IN_PROGRESS => Some("STATUS_CLUSTER_JOIN_IN_PROGRESS"), + SMB_NTSTATUS_CLUSTER_NODE_NOT_FOUND => Some("STATUS_CLUSTER_NODE_NOT_FOUND"), + SMB_NTSTATUS_CLUSTER_LOCAL_NODE_NOT_FOUND => Some("STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND"), + SMB_NTSTATUS_CLUSTER_NETWORK_EXISTS => Some("STATUS_CLUSTER_NETWORK_EXISTS"), + SMB_NTSTATUS_CLUSTER_NETWORK_NOT_FOUND => Some("STATUS_CLUSTER_NETWORK_NOT_FOUND"), + SMB_NTSTATUS_CLUSTER_NETINTERFACE_EXISTS => Some("STATUS_CLUSTER_NETINTERFACE_EXISTS"), + SMB_NTSTATUS_CLUSTER_NETINTERFACE_NOT_FOUND => { + Some("STATUS_CLUSTER_NETINTERFACE_NOT_FOUND") + } + SMB_NTSTATUS_CLUSTER_INVALID_REQUEST => Some("STATUS_CLUSTER_INVALID_REQUEST"), + SMB_NTSTATUS_CLUSTER_INVALID_NETWORK_PROVIDER => { + Some("STATUS_CLUSTER_INVALID_NETWORK_PROVIDER") + } + SMB_NTSTATUS_CLUSTER_NODE_DOWN => Some("STATUS_CLUSTER_NODE_DOWN"), + SMB_NTSTATUS_CLUSTER_NODE_UNREACHABLE => Some("STATUS_CLUSTER_NODE_UNREACHABLE"), + SMB_NTSTATUS_CLUSTER_NODE_NOT_MEMBER => Some("STATUS_CLUSTER_NODE_NOT_MEMBER"), + SMB_NTSTATUS_CLUSTER_JOIN_NOT_IN_PROGRESS => Some("STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS"), + SMB_NTSTATUS_CLUSTER_INVALID_NETWORK => Some("STATUS_CLUSTER_INVALID_NETWORK"), + SMB_NTSTATUS_CLUSTER_NO_NET_ADAPTERS => Some("STATUS_CLUSTER_NO_NET_ADAPTERS"), + SMB_NTSTATUS_CLUSTER_NODE_UP => Some("STATUS_CLUSTER_NODE_UP"), + SMB_NTSTATUS_CLUSTER_NODE_PAUSED => Some("STATUS_CLUSTER_NODE_PAUSED"), + SMB_NTSTATUS_CLUSTER_NODE_NOT_PAUSED => Some("STATUS_CLUSTER_NODE_NOT_PAUSED"), + SMB_NTSTATUS_CLUSTER_NO_SECURITY_CONTEXT => Some("STATUS_CLUSTER_NO_SECURITY_CONTEXT"), + SMB_NTSTATUS_CLUSTER_NETWORK_NOT_INTERNAL => Some("STATUS_CLUSTER_NETWORK_NOT_INTERNAL"), + SMB_NTSTATUS_CLUSTER_POISONED => Some("STATUS_CLUSTER_POISONED"), + SMB_NTSTATUS_ACPI_INVALID_OPCODE => Some("STATUS_ACPI_INVALID_OPCODE"), + SMB_NTSTATUS_ACPI_STACK_OVERFLOW => Some("STATUS_ACPI_STACK_OVERFLOW"), + SMB_NTSTATUS_ACPI_ASSERT_FAILED => Some("STATUS_ACPI_ASSERT_FAILED"), + SMB_NTSTATUS_ACPI_INVALID_INDEX => Some("STATUS_ACPI_INVALID_INDEX"), + SMB_NTSTATUS_ACPI_INVALID_ARGUMENT => Some("STATUS_ACPI_INVALID_ARGUMENT"), + SMB_NTSTATUS_ACPI_FATAL => Some("STATUS_ACPI_FATAL"), + SMB_NTSTATUS_ACPI_INVALID_SUPERNAME => Some("STATUS_ACPI_INVALID_SUPERNAME"), + SMB_NTSTATUS_ACPI_INVALID_ARGTYPE => Some("STATUS_ACPI_INVALID_ARGTYPE"), + SMB_NTSTATUS_ACPI_INVALID_OBJTYPE => Some("STATUS_ACPI_INVALID_OBJTYPE"), + SMB_NTSTATUS_ACPI_INVALID_TARGETTYPE => Some("STATUS_ACPI_INVALID_TARGETTYPE"), + SMB_NTSTATUS_ACPI_INCORRECT_ARGUMENT_COUNT => Some("STATUS_ACPI_INCORRECT_ARGUMENT_COUNT"), + SMB_NTSTATUS_ACPI_ADDRESS_NOT_MAPPED => Some("STATUS_ACPI_ADDRESS_NOT_MAPPED"), + SMB_NTSTATUS_ACPI_INVALID_EVENTTYPE => Some("STATUS_ACPI_INVALID_EVENTTYPE"), + SMB_NTSTATUS_ACPI_HANDLER_COLLISION => Some("STATUS_ACPI_HANDLER_COLLISION"), + SMB_NTSTATUS_ACPI_INVALID_DATA => Some("STATUS_ACPI_INVALID_DATA"), + SMB_NTSTATUS_ACPI_INVALID_REGION => Some("STATUS_ACPI_INVALID_REGION"), + SMB_NTSTATUS_ACPI_INVALID_ACCESS_SIZE => Some("STATUS_ACPI_INVALID_ACCESS_SIZE"), + SMB_NTSTATUS_ACPI_ACQUIRE_GLOBAL_LOCK => Some("STATUS_ACPI_ACQUIRE_GLOBAL_LOCK"), + SMB_NTSTATUS_ACPI_ALREADY_INITIALIZED => Some("STATUS_ACPI_ALREADY_INITIALIZED"), + SMB_NTSTATUS_ACPI_NOT_INITIALIZED => Some("STATUS_ACPI_NOT_INITIALIZED"), + SMB_NTSTATUS_ACPI_INVALID_MUTEX_LEVEL => Some("STATUS_ACPI_INVALID_MUTEX_LEVEL"), + SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNED => Some("STATUS_ACPI_MUTEX_NOT_OWNED"), + SMB_NTSTATUS_ACPI_MUTEX_NOT_OWNER => Some("STATUS_ACPI_MUTEX_NOT_OWNER"), + SMB_NTSTATUS_ACPI_RS_ACCESS => Some("STATUS_ACPI_RS_ACCESS"), + SMB_NTSTATUS_ACPI_INVALID_TABLE => Some("STATUS_ACPI_INVALID_TABLE"), + SMB_NTSTATUS_ACPI_REG_HANDLER_FAILED => Some("STATUS_ACPI_REG_HANDLER_FAILED"), + SMB_NTSTATUS_ACPI_POWER_REQUEST_FAILED => Some("STATUS_ACPI_POWER_REQUEST_FAILED"), + SMB_NTSTATUS_SXS_SECTION_NOT_FOUND => Some("STATUS_SXS_SECTION_NOT_FOUND"), + SMB_NTSTATUS_SXS_CANT_GEN_ACTCTX => Some("STATUS_SXS_CANT_GEN_ACTCTX"), + SMB_NTSTATUS_SXS_INVALID_ACTCTXDATA_FORMAT => Some("STATUS_SXS_INVALID_ACTCTXDATA_FORMAT"), + SMB_NTSTATUS_SXS_ASSEMBLY_NOT_FOUND => Some("STATUS_SXS_ASSEMBLY_NOT_FOUND"), + SMB_NTSTATUS_SXS_MANIFEST_FORMAT_ERROR => Some("STATUS_SXS_MANIFEST_FORMAT_ERROR"), + SMB_NTSTATUS_SXS_MANIFEST_PARSE_ERROR => Some("STATUS_SXS_MANIFEST_PARSE_ERROR"), + SMB_NTSTATUS_SXS_ACTIVATION_CONTEXT_DISABLED => { + Some("STATUS_SXS_ACTIVATION_CONTEXT_DISABLED") + } + SMB_NTSTATUS_SXS_KEY_NOT_FOUND => Some("STATUS_SXS_KEY_NOT_FOUND"), + SMB_NTSTATUS_SXS_VERSION_CONFLICT => Some("STATUS_SXS_VERSION_CONFLICT"), + SMB_NTSTATUS_SXS_WRONG_SECTION_TYPE => Some("STATUS_SXS_WRONG_SECTION_TYPE"), + SMB_NTSTATUS_SXS_THREAD_QUERIES_DISABLED => Some("STATUS_SXS_THREAD_QUERIES_DISABLED"), + SMB_NTSTATUS_SXS_ASSEMBLY_MISSING => Some("STATUS_SXS_ASSEMBLY_MISSING"), + SMB_NTSTATUS_SXS_PROCESS_DEFAULT_ALREADY_SET => { + Some("STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET") + } + SMB_NTSTATUS_SXS_EARLY_DEACTIVATION => Some("STATUS_SXS_EARLY_DEACTIVATION"), + SMB_NTSTATUS_SXS_INVALID_DEACTIVATION => Some("STATUS_SXS_INVALID_DEACTIVATION"), + SMB_NTSTATUS_SXS_MULTIPLE_DEACTIVATION => Some("STATUS_SXS_MULTIPLE_DEACTIVATION"), + SMB_NTSTATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY => { + Some("STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY") + } + SMB_NTSTATUS_SXS_PROCESS_TERMINATION_REQUESTED => { + Some("STATUS_SXS_PROCESS_TERMINATION_REQUESTED") + } + SMB_NTSTATUS_SXS_CORRUPT_ACTIVATION_STACK => Some("STATUS_SXS_CORRUPT_ACTIVATION_STACK"), + SMB_NTSTATUS_SXS_CORRUPTION => Some("STATUS_SXS_CORRUPTION"), + SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE => { + Some("STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE") + } + SMB_NTSTATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME => { + Some("STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME") + } + SMB_NTSTATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE => { + Some("STATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE") + } + SMB_NTSTATUS_SXS_IDENTITY_PARSE_ERROR => Some("STATUS_SXS_IDENTITY_PARSE_ERROR"), + SMB_NTSTATUS_SXS_COMPONENT_STORE_CORRUPT => Some("STATUS_SXS_COMPONENT_STORE_CORRUPT"), + SMB_NTSTATUS_SXS_FILE_HASH_MISMATCH => Some("STATUS_SXS_FILE_HASH_MISMATCH"), + SMB_NTSTATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT => { + Some("STATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT") + } + SMB_NTSTATUS_SXS_IDENTITIES_DIFFERENT => Some("STATUS_SXS_IDENTITIES_DIFFERENT"), + SMB_NTSTATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT => { + Some("STATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT") + } + SMB_NTSTATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY => Some("STATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY"), + SMB_NTSTATUS_ADVANCED_INSTALLER_FAILED => Some("STATUS_ADVANCED_INSTALLER_FAILED"), + SMB_NTSTATUS_XML_ENCODING_MISMATCH => Some("STATUS_XML_ENCODING_MISMATCH"), + SMB_NTSTATUS_SXS_MANIFEST_TOO_BIG => Some("STATUS_SXS_MANIFEST_TOO_BIG"), + SMB_NTSTATUS_SXS_SETTING_NOT_REGISTERED => Some("STATUS_SXS_SETTING_NOT_REGISTERED"), + SMB_NTSTATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE => { + Some("STATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE") + } + SMB_NTSTATUS_SMI_PRIMITIVE_INSTALLER_FAILED => { + Some("STATUS_SMI_PRIMITIVE_INSTALLER_FAILED") + } + SMB_NTSTATUS_GENERIC_COMMAND_FAILED => Some("STATUS_GENERIC_COMMAND_FAILED"), + SMB_NTSTATUS_SXS_FILE_HASH_MISSING => Some("STATUS_SXS_FILE_HASH_MISSING"), + SMB_NTSTATUS_TRANSACTIONAL_CONFLICT => Some("STATUS_TRANSACTIONAL_CONFLICT"), + SMB_NTSTATUS_INVALID_TRANSACTION => Some("STATUS_INVALID_TRANSACTION"), + SMB_NTSTATUS_TRANSACTION_NOT_ACTIVE => Some("STATUS_TRANSACTION_NOT_ACTIVE"), + SMB_NTSTATUS_TM_INITIALIZATION_FAILED => Some("STATUS_TM_INITIALIZATION_FAILED"), + SMB_NTSTATUS_RM_NOT_ACTIVE => Some("STATUS_RM_NOT_ACTIVE"), + SMB_NTSTATUS_RM_METADATA_CORRUPT => Some("STATUS_RM_METADATA_CORRUPT"), + SMB_NTSTATUS_TRANSACTION_NOT_JOINED => Some("STATUS_TRANSACTION_NOT_JOINED"), + SMB_NTSTATUS_DIRECTORY_NOT_RM => Some("STATUS_DIRECTORY_NOT_RM"), + SMB_NTSTATUS_TRANSACTIONS_UNSUPPORTED_REMOTE => { + Some("STATUS_TRANSACTIONS_UNSUPPORTED_REMOTE") + } + SMB_NTSTATUS_LOG_RESIZE_INVALID_SIZE => Some("STATUS_LOG_RESIZE_INVALID_SIZE"), + SMB_NTSTATUS_REMOTE_FILE_VERSION_MISMATCH => Some("STATUS_REMOTE_FILE_VERSION_MISMATCH"), + SMB_NTSTATUS_CRM_PROTOCOL_ALREADY_EXISTS => Some("STATUS_CRM_PROTOCOL_ALREADY_EXISTS"), + SMB_NTSTATUS_TRANSACTION_PROPAGATION_FAILED => { + Some("STATUS_TRANSACTION_PROPAGATION_FAILED") + } + SMB_NTSTATUS_CRM_PROTOCOL_NOT_FOUND => Some("STATUS_CRM_PROTOCOL_NOT_FOUND"), + SMB_NTSTATUS_TRANSACTION_SUPERIOR_EXISTS => Some("STATUS_TRANSACTION_SUPERIOR_EXISTS"), + SMB_NTSTATUS_TRANSACTION_REQUEST_NOT_VALID => Some("STATUS_TRANSACTION_REQUEST_NOT_VALID"), + SMB_NTSTATUS_TRANSACTION_NOT_REQUESTED => Some("STATUS_TRANSACTION_NOT_REQUESTED"), + SMB_NTSTATUS_TRANSACTION_ALREADY_ABORTED => Some("STATUS_TRANSACTION_ALREADY_ABORTED"), + SMB_NTSTATUS_TRANSACTION_ALREADY_COMMITTED => Some("STATUS_TRANSACTION_ALREADY_COMMITTED"), + SMB_NTSTATUS_TRANSACTION_INVALID_MARSHALL_BUFFER => { + Some("STATUS_TRANSACTION_INVALID_MARSHALL_BUFFER") + } + SMB_NTSTATUS_CURRENT_TRANSACTION_NOT_VALID => Some("STATUS_CURRENT_TRANSACTION_NOT_VALID"), + SMB_NTSTATUS_LOG_GROWTH_FAILED => Some("STATUS_LOG_GROWTH_FAILED"), + SMB_NTSTATUS_OBJECT_NO_LONGER_EXISTS => Some("STATUS_OBJECT_NO_LONGER_EXISTS"), + SMB_NTSTATUS_STREAM_MINIVERSION_NOT_FOUND => Some("STATUS_STREAM_MINIVERSION_NOT_FOUND"), + SMB_NTSTATUS_STREAM_MINIVERSION_NOT_VALID => Some("STATUS_STREAM_MINIVERSION_NOT_VALID"), + SMB_NTSTATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION => { + Some("STATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION") + } + SMB_NTSTATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT => { + Some("STATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT") + } + SMB_NTSTATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS => { + Some("STATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS") + } + SMB_NTSTATUS_HANDLE_NO_LONGER_VALID => Some("STATUS_HANDLE_NO_LONGER_VALID"), + SMB_NTSTATUS_LOG_CORRUPTION_DETECTED => Some("STATUS_LOG_CORRUPTION_DETECTED"), + SMB_NTSTATUS_RM_DISCONNECTED => Some("STATUS_RM_DISCONNECTED"), + SMB_NTSTATUS_ENLISTMENT_NOT_SUPERIOR => Some("STATUS_ENLISTMENT_NOT_SUPERIOR"), + SMB_NTSTATUS_FILE_IDENTITY_NOT_PERSISTENT => Some("STATUS_FILE_IDENTITY_NOT_PERSISTENT"), + SMB_NTSTATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY => { + Some("STATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY") + } + SMB_NTSTATUS_CANT_CROSS_RM_BOUNDARY => Some("STATUS_CANT_CROSS_RM_BOUNDARY"), + SMB_NTSTATUS_TXF_DIR_NOT_EMPTY => Some("STATUS_TXF_DIR_NOT_EMPTY"), + SMB_NTSTATUS_INDOUBT_TRANSACTIONS_EXIST => Some("STATUS_INDOUBT_TRANSACTIONS_EXIST"), + SMB_NTSTATUS_TM_VOLATILE => Some("STATUS_TM_VOLATILE"), + SMB_NTSTATUS_ROLLBACK_TIMER_EXPIRED => Some("STATUS_ROLLBACK_TIMER_EXPIRED"), + SMB_NTSTATUS_TXF_ATTRIBUTE_CORRUPT => Some("STATUS_TXF_ATTRIBUTE_CORRUPT"), + SMB_NTSTATUS_EFS_NOT_ALLOWED_IN_TRANSACTION => { + Some("STATUS_EFS_NOT_ALLOWED_IN_TRANSACTION") + } + SMB_NTSTATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED => { + Some("STATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED") + } + SMB_NTSTATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE => { + Some("STATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE") + } + SMB_NTSTATUS_TRANSACTION_REQUIRED_PROMOTION => { + Some("STATUS_TRANSACTION_REQUIRED_PROMOTION") + } + SMB_NTSTATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION => { + Some("STATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION") + } + SMB_NTSTATUS_TRANSACTIONS_NOT_FROZEN => Some("STATUS_TRANSACTIONS_NOT_FROZEN"), + SMB_NTSTATUS_TRANSACTION_FREEZE_IN_PROGRESS => { + Some("STATUS_TRANSACTION_FREEZE_IN_PROGRESS") + } + SMB_NTSTATUS_NOT_SNAPSHOT_VOLUME => Some("STATUS_NOT_SNAPSHOT_VOLUME"), + SMB_NTSTATUS_NO_SAVEPOINT_WITH_OPEN_FILES => Some("STATUS_NO_SAVEPOINT_WITH_OPEN_FILES"), + SMB_NTSTATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION => { + Some("STATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION") + } + SMB_NTSTATUS_TM_IDENTITY_MISMATCH => Some("STATUS_TM_IDENTITY_MISMATCH"), + SMB_NTSTATUS_FLOATED_SECTION => Some("STATUS_FLOATED_SECTION"), + SMB_NTSTATUS_CANNOT_ACCEPT_TRANSACTED_WORK => Some("STATUS_CANNOT_ACCEPT_TRANSACTED_WORK"), + SMB_NTSTATUS_CANNOT_ABORT_TRANSACTIONS => Some("STATUS_CANNOT_ABORT_TRANSACTIONS"), + SMB_NTSTATUS_TRANSACTION_NOT_FOUND => Some("STATUS_TRANSACTION_NOT_FOUND"), + SMB_NTSTATUS_RESOURCEMANAGER_NOT_FOUND => Some("STATUS_RESOURCEMANAGER_NOT_FOUND"), + SMB_NTSTATUS_ENLISTMENT_NOT_FOUND => Some("STATUS_ENLISTMENT_NOT_FOUND"), + SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_FOUND => Some("STATUS_TRANSACTIONMANAGER_NOT_FOUND"), + SMB_NTSTATUS_TRANSACTIONMANAGER_NOT_ONLINE => Some("STATUS_TRANSACTIONMANAGER_NOT_ONLINE"), + SMB_NTSTATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION => { + Some("STATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION") + } + SMB_NTSTATUS_TRANSACTION_NOT_ROOT => Some("STATUS_TRANSACTION_NOT_ROOT"), + SMB_NTSTATUS_TRANSACTION_OBJECT_EXPIRED => Some("STATUS_TRANSACTION_OBJECT_EXPIRED"), + SMB_NTSTATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION => { + Some("STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION") + } + SMB_NTSTATUS_TRANSACTION_RESPONSE_NOT_ENLISTED => { + Some("STATUS_TRANSACTION_RESPONSE_NOT_ENLISTED") + } + SMB_NTSTATUS_TRANSACTION_RECORD_TOO_LONG => Some("STATUS_TRANSACTION_RECORD_TOO_LONG"), + SMB_NTSTATUS_NO_LINK_TRACKING_IN_TRANSACTION => { + Some("STATUS_NO_LINK_TRACKING_IN_TRANSACTION") + } + SMB_NTSTATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION => { + Some("STATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION") + } + SMB_NTSTATUS_TRANSACTION_INTEGRITY_VIOLATED => { + Some("STATUS_TRANSACTION_INTEGRITY_VIOLATED") + } + SMB_NTSTATUS_EXPIRED_HANDLE => Some("STATUS_EXPIRED_HANDLE"), + SMB_NTSTATUS_TRANSACTION_NOT_ENLISTED => Some("STATUS_TRANSACTION_NOT_ENLISTED"), + SMB_NTSTATUS_LOG_SECTOR_INVALID => Some("STATUS_LOG_SECTOR_INVALID"), + SMB_NTSTATUS_LOG_SECTOR_PARITY_INVALID => Some("STATUS_LOG_SECTOR_PARITY_INVALID"), + SMB_NTSTATUS_LOG_SECTOR_REMAPPED => Some("STATUS_LOG_SECTOR_REMAPPED"), + SMB_NTSTATUS_LOG_BLOCK_INCOMPLETE => Some("STATUS_LOG_BLOCK_INCOMPLETE"), + SMB_NTSTATUS_LOG_INVALID_RANGE => Some("STATUS_LOG_INVALID_RANGE"), + SMB_NTSTATUS_LOG_BLOCKS_EXHAUSTED => Some("STATUS_LOG_BLOCKS_EXHAUSTED"), + SMB_NTSTATUS_LOG_READ_CONTEXT_INVALID => Some("STATUS_LOG_READ_CONTEXT_INVALID"), + SMB_NTSTATUS_LOG_RESTART_INVALID => Some("STATUS_LOG_RESTART_INVALID"), + SMB_NTSTATUS_LOG_BLOCK_VERSION => Some("STATUS_LOG_BLOCK_VERSION"), + SMB_NTSTATUS_LOG_BLOCK_INVALID => Some("STATUS_LOG_BLOCK_INVALID"), + SMB_NTSTATUS_LOG_READ_MODE_INVALID => Some("STATUS_LOG_READ_MODE_INVALID"), + SMB_NTSTATUS_LOG_METADATA_CORRUPT => Some("STATUS_LOG_METADATA_CORRUPT"), + SMB_NTSTATUS_LOG_METADATA_INVALID => Some("STATUS_LOG_METADATA_INVALID"), + SMB_NTSTATUS_LOG_METADATA_INCONSISTENT => Some("STATUS_LOG_METADATA_INCONSISTENT"), + SMB_NTSTATUS_LOG_RESERVATION_INVALID => Some("STATUS_LOG_RESERVATION_INVALID"), + SMB_NTSTATUS_LOG_CANT_DELETE => Some("STATUS_LOG_CANT_DELETE"), + SMB_NTSTATUS_LOG_CONTAINER_LIMIT_EXCEEDED => Some("STATUS_LOG_CONTAINER_LIMIT_EXCEEDED"), + SMB_NTSTATUS_LOG_START_OF_LOG => Some("STATUS_LOG_START_OF_LOG"), + SMB_NTSTATUS_LOG_POLICY_ALREADY_INSTALLED => Some("STATUS_LOG_POLICY_ALREADY_INSTALLED"), + SMB_NTSTATUS_LOG_POLICY_NOT_INSTALLED => Some("STATUS_LOG_POLICY_NOT_INSTALLED"), + SMB_NTSTATUS_LOG_POLICY_INVALID => Some("STATUS_LOG_POLICY_INVALID"), + SMB_NTSTATUS_LOG_POLICY_CONFLICT => Some("STATUS_LOG_POLICY_CONFLICT"), + SMB_NTSTATUS_LOG_PINNED_ARCHIVE_TAIL => Some("STATUS_LOG_PINNED_ARCHIVE_TAIL"), + SMB_NTSTATUS_LOG_RECORD_NONEXISTENT => Some("STATUS_LOG_RECORD_NONEXISTENT"), + SMB_NTSTATUS_LOG_RECORDS_RESERVED_INVALID => Some("STATUS_LOG_RECORDS_RESERVED_INVALID"), + SMB_NTSTATUS_LOG_SPACE_RESERVED_INVALID => Some("STATUS_LOG_SPACE_RESERVED_INVALID"), + SMB_NTSTATUS_LOG_TAIL_INVALID => Some("STATUS_LOG_TAIL_INVALID"), + SMB_NTSTATUS_LOG_FULL => Some("STATUS_LOG_FULL"), + SMB_NTSTATUS_LOG_MULTIPLEXED => Some("STATUS_LOG_MULTIPLEXED"), + SMB_NTSTATUS_LOG_DEDICATED => Some("STATUS_LOG_DEDICATED"), + SMB_NTSTATUS_LOG_ARCHIVE_NOT_IN_PROGRESS => Some("STATUS_LOG_ARCHIVE_NOT_IN_PROGRESS"), + SMB_NTSTATUS_LOG_ARCHIVE_IN_PROGRESS => Some("STATUS_LOG_ARCHIVE_IN_PROGRESS"), + SMB_NTSTATUS_LOG_EPHEMERAL => Some("STATUS_LOG_EPHEMERAL"), + SMB_NTSTATUS_LOG_NOT_ENOUGH_CONTAINERS => Some("STATUS_LOG_NOT_ENOUGH_CONTAINERS"), + SMB_NTSTATUS_LOG_CLIENT_ALREADY_REGISTERED => Some("STATUS_LOG_CLIENT_ALREADY_REGISTERED"), + SMB_NTSTATUS_LOG_CLIENT_NOT_REGISTERED => Some("STATUS_LOG_CLIENT_NOT_REGISTERED"), + SMB_NTSTATUS_LOG_FULL_HANDLER_IN_PROGRESS => Some("STATUS_LOG_FULL_HANDLER_IN_PROGRESS"), + SMB_NTSTATUS_LOG_CONTAINER_READ_FAILED => Some("STATUS_LOG_CONTAINER_READ_FAILED"), + SMB_NTSTATUS_LOG_CONTAINER_WRITE_FAILED => Some("STATUS_LOG_CONTAINER_WRITE_FAILED"), + SMB_NTSTATUS_LOG_CONTAINER_OPEN_FAILED => Some("STATUS_LOG_CONTAINER_OPEN_FAILED"), + SMB_NTSTATUS_LOG_CONTAINER_STATE_INVALID => Some("STATUS_LOG_CONTAINER_STATE_INVALID"), + SMB_NTSTATUS_LOG_STATE_INVALID => Some("STATUS_LOG_STATE_INVALID"), + SMB_NTSTATUS_LOG_PINNED => Some("STATUS_LOG_PINNED"), + SMB_NTSTATUS_LOG_METADATA_FLUSH_FAILED => Some("STATUS_LOG_METADATA_FLUSH_FAILED"), + SMB_NTSTATUS_LOG_INCONSISTENT_SECURITY => Some("STATUS_LOG_INCONSISTENT_SECURITY"), + SMB_NTSTATUS_LOG_APPENDED_FLUSH_FAILED => Some("STATUS_LOG_APPENDED_FLUSH_FAILED"), + SMB_NTSTATUS_LOG_PINNED_RESERVATION => Some("STATUS_LOG_PINNED_RESERVATION"), + SMB_NTSTATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD => { + Some("STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD") + } + SMB_NTSTATUS_FLT_NO_HANDLER_DEFINED => Some("STATUS_FLT_NO_HANDLER_DEFINED"), + SMB_NTSTATUS_FLT_CONTEXT_ALREADY_DEFINED => Some("STATUS_FLT_CONTEXT_ALREADY_DEFINED"), + SMB_NTSTATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST => { + Some("STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST") + } + SMB_NTSTATUS_FLT_DISALLOW_FAST_IO => Some("STATUS_FLT_DISALLOW_FAST_IO"), + SMB_NTSTATUS_FLT_INVALID_NAME_REQUEST => Some("STATUS_FLT_INVALID_NAME_REQUEST"), + SMB_NTSTATUS_FLT_NOT_SAFE_TO_POST_OPERATION => { + Some("STATUS_FLT_NOT_SAFE_TO_POST_OPERATION") + } + SMB_NTSTATUS_FLT_NOT_INITIALIZED => Some("STATUS_FLT_NOT_INITIALIZED"), + SMB_NTSTATUS_FLT_FILTER_NOT_READY => Some("STATUS_FLT_FILTER_NOT_READY"), + SMB_NTSTATUS_FLT_POST_OPERATION_CLEANUP => Some("STATUS_FLT_POST_OPERATION_CLEANUP"), + SMB_NTSTATUS_FLT_INTERNAL_ERROR => Some("STATUS_FLT_INTERNAL_ERROR"), + SMB_NTSTATUS_FLT_DELETING_OBJECT => Some("STATUS_FLT_DELETING_OBJECT"), + SMB_NTSTATUS_FLT_MUST_BE_NONPAGED_POOL => Some("STATUS_FLT_MUST_BE_NONPAGED_POOL"), + SMB_NTSTATUS_FLT_DUPLICATE_ENTRY => Some("STATUS_FLT_DUPLICATE_ENTRY"), + SMB_NTSTATUS_FLT_CBDQ_DISABLED => Some("STATUS_FLT_CBDQ_DISABLED"), + SMB_NTSTATUS_FLT_DO_NOT_ATTACH => Some("STATUS_FLT_DO_NOT_ATTACH"), + SMB_NTSTATUS_FLT_DO_NOT_DETACH => Some("STATUS_FLT_DO_NOT_DETACH"), + SMB_NTSTATUS_FLT_INSTANCE_ALTITUDE_COLLISION => { + Some("STATUS_FLT_INSTANCE_ALTITUDE_COLLISION") + } + SMB_NTSTATUS_FLT_INSTANCE_NAME_COLLISION => Some("STATUS_FLT_INSTANCE_NAME_COLLISION"), + SMB_NTSTATUS_FLT_FILTER_NOT_FOUND => Some("STATUS_FLT_FILTER_NOT_FOUND"), + SMB_NTSTATUS_FLT_VOLUME_NOT_FOUND => Some("STATUS_FLT_VOLUME_NOT_FOUND"), + SMB_NTSTATUS_FLT_INSTANCE_NOT_FOUND => Some("STATUS_FLT_INSTANCE_NOT_FOUND"), + SMB_NTSTATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND => { + Some("STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND") + } + SMB_NTSTATUS_FLT_INVALID_CONTEXT_REGISTRATION => { + Some("STATUS_FLT_INVALID_CONTEXT_REGISTRATION") + } + SMB_NTSTATUS_FLT_NAME_CACHE_MISS => Some("STATUS_FLT_NAME_CACHE_MISS"), + SMB_NTSTATUS_FLT_NO_DEVICE_OBJECT => Some("STATUS_FLT_NO_DEVICE_OBJECT"), + SMB_NTSTATUS_FLT_VOLUME_ALREADY_MOUNTED => Some("STATUS_FLT_VOLUME_ALREADY_MOUNTED"), + SMB_NTSTATUS_FLT_ALREADY_ENLISTED => Some("STATUS_FLT_ALREADY_ENLISTED"), + SMB_NTSTATUS_FLT_CONTEXT_ALREADY_LINKED => Some("STATUS_FLT_CONTEXT_ALREADY_LINKED"), + SMB_NTSTATUS_FLT_NO_WAITER_FOR_REPLY => Some("STATUS_FLT_NO_WAITER_FOR_REPLY"), + SMB_NTSTATUS_MONITOR_NO_DESCRIPTOR => Some("STATUS_MONITOR_NO_DESCRIPTOR"), + SMB_NTSTATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT => { + Some("STATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT") + } + SMB_NTSTATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM => { + Some("STATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM") + } + SMB_NTSTATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK => { + Some("STATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK") + } + SMB_NTSTATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED => { + Some("STATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED") + } + SMB_NTSTATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK => { + Some("STATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK") + } + SMB_NTSTATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK => { + Some("STATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK") + } + SMB_NTSTATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA => { + Some("STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA") + } + SMB_NTSTATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK => { + Some("STATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK") + } + SMB_NTSTATUS_MONITOR_INVALID_MANUFACTURE_DATE => { + Some("STATUS_MONITOR_INVALID_MANUFACTURE_DATE") + } + SMB_NTSTATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER => { + Some("STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER") + } + SMB_NTSTATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER => { + Some("STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER") + } + SMB_NTSTATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER => { + Some("STATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER") + } + SMB_NTSTATUS_GRAPHICS_ADAPTER_WAS_RESET => Some("STATUS_GRAPHICS_ADAPTER_WAS_RESET"), + SMB_NTSTATUS_GRAPHICS_INVALID_DRIVER_MODEL => Some("STATUS_GRAPHICS_INVALID_DRIVER_MODEL"), + SMB_NTSTATUS_GRAPHICS_PRESENT_MODE_CHANGED => Some("STATUS_GRAPHICS_PRESENT_MODE_CHANGED"), + SMB_NTSTATUS_GRAPHICS_PRESENT_OCCLUDED => Some("STATUS_GRAPHICS_PRESENT_OCCLUDED"), + SMB_NTSTATUS_GRAPHICS_PRESENT_DENIED => Some("STATUS_GRAPHICS_PRESENT_DENIED"), + SMB_NTSTATUS_GRAPHICS_CANNOTCOLORCONVERT => Some("STATUS_GRAPHICS_CANNOTCOLORCONVERT"), + SMB_NTSTATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED => { + Some("STATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED") + } + SMB_NTSTATUS_GRAPHICS_PRESENT_UNOCCLUDED => Some("STATUS_GRAPHICS_PRESENT_UNOCCLUDED"), + SMB_NTSTATUS_GRAPHICS_NO_VIDEO_MEMORY => Some("STATUS_GRAPHICS_NO_VIDEO_MEMORY"), + SMB_NTSTATUS_GRAPHICS_CANT_LOCK_MEMORY => Some("STATUS_GRAPHICS_CANT_LOCK_MEMORY"), + SMB_NTSTATUS_GRAPHICS_ALLOCATION_BUSY => Some("STATUS_GRAPHICS_ALLOCATION_BUSY"), + SMB_NTSTATUS_GRAPHICS_TOO_MANY_REFERENCES => Some("STATUS_GRAPHICS_TOO_MANY_REFERENCES"), + SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_LATER => Some("STATUS_GRAPHICS_TRY_AGAIN_LATER"), + SMB_NTSTATUS_GRAPHICS_TRY_AGAIN_NOW => Some("STATUS_GRAPHICS_TRY_AGAIN_NOW"), + SMB_NTSTATUS_GRAPHICS_ALLOCATION_INVALID => Some("STATUS_GRAPHICS_ALLOCATION_INVALID"), + SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE => { + Some("STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE") + } + SMB_NTSTATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED => { + Some("STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION => { + Some("STATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION") + } + SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_USAGE => { + Some("STATUS_GRAPHICS_INVALID_ALLOCATION_USAGE") + } + SMB_NTSTATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION => { + Some("STATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION") + } + SMB_NTSTATUS_GRAPHICS_ALLOCATION_CLOSED => Some("STATUS_GRAPHICS_ALLOCATION_CLOSED"), + SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE => { + Some("STATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE => { + Some("STATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE") + } + SMB_NTSTATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE => { + Some("STATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE") + } + SMB_NTSTATUS_GRAPHICS_ALLOCATION_CONTENT_LOST => { + Some("STATUS_GRAPHICS_ALLOCATION_CONTENT_LOST") + } + SMB_NTSTATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE => { + Some("STATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY => { + Some("STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY") + } + SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN => Some("STATUS_GRAPHICS_INVALID_VIDPN"), + SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE => { + Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET => { + Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET") + } + SMB_NTSTATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET => { + Some("STATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET => { + Some("STATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_FREQUENCY => Some("STATUS_GRAPHICS_INVALID_FREQUENCY"), + SMB_NTSTATUS_GRAPHICS_INVALID_ACTIVE_REGION => { + Some("STATUS_GRAPHICS_INVALID_ACTIVE_REGION") + } + SMB_NTSTATUS_GRAPHICS_INVALID_TOTAL_REGION => Some("STATUS_GRAPHICS_INVALID_TOTAL_REGION"), + SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE => { + Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE => { + Some("STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE") + } + SMB_NTSTATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET => { + Some("STATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET") + } + SMB_NTSTATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY => { + Some("STATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY") + } + SMB_NTSTATUS_GRAPHICS_MODE_ALREADY_IN_MODESET => { + Some("STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET => { + Some("STATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET => { + Some("STATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET") + } + SMB_NTSTATUS_GRAPHICS_SOURCE_ALREADY_IN_SET => { + Some("STATUS_GRAPHICS_SOURCE_ALREADY_IN_SET") + } + SMB_NTSTATUS_GRAPHICS_TARGET_ALREADY_IN_SET => { + Some("STATUS_GRAPHICS_TARGET_ALREADY_IN_SET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH => { + Some("STATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH") + } + SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY => { + Some("STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET => { + Some("STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE => { + Some("STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE") + } + SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET => { + Some("STATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET") + } + SMB_NTSTATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET => { + Some("STATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET") + } + SMB_NTSTATUS_GRAPHICS_STALE_MODESET => Some("STATUS_GRAPHICS_STALE_MODESET"), + SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET => { + Some("STATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE => { + Some("STATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE") + } + SMB_NTSTATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN => { + Some("STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN") + } + SMB_NTSTATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE => { + Some("STATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE") + } + SMB_NTSTATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION => { + Some("STATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION") + } + SMB_NTSTATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES => { + Some("STATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES") + } + SMB_NTSTATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY => Some("STATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY"), + SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE => { + Some("STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE") + } + SMB_NTSTATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET => { + Some("STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET => { + Some("STATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR => { + Some("STATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR") + } + SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET => { + Some("STATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET") + } + SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET => { + Some("STATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET") + } + SMB_NTSTATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE => { + Some("STATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE => { + Some("STATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE") + } + SMB_NTSTATUS_GRAPHICS_RESOURCES_NOT_RELATED => { + Some("STATUS_GRAPHICS_RESOURCES_NOT_RELATED") + } + SMB_NTSTATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE => { + Some("STATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE") + } + SMB_NTSTATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE => { + Some("STATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE") + } + SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET => { + Some("STATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET") + } + SMB_NTSTATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER => { + Some("STATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER") + } + SMB_NTSTATUS_GRAPHICS_NO_VIDPNMGR => Some("STATUS_GRAPHICS_NO_VIDPNMGR"), + SMB_NTSTATUS_GRAPHICS_NO_ACTIVE_VIDPN => Some("STATUS_GRAPHICS_NO_ACTIVE_VIDPN"), + SMB_NTSTATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY => Some("STATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY"), + SMB_NTSTATUS_GRAPHICS_MONITOR_NOT_CONNECTED => { + Some("STATUS_GRAPHICS_MONITOR_NOT_CONNECTED") + } + SMB_NTSTATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY => { + Some("STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY") + } + SMB_NTSTATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE => { + Some("STATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE => { + Some("STATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_STRIDE => Some("STATUS_GRAPHICS_INVALID_STRIDE"), + SMB_NTSTATUS_GRAPHICS_INVALID_PIXELFORMAT => Some("STATUS_GRAPHICS_INVALID_PIXELFORMAT"), + SMB_NTSTATUS_GRAPHICS_INVALID_COLORBASIS => Some("STATUS_GRAPHICS_INVALID_COLORBASIS"), + SMB_NTSTATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE => { + Some("STATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE") + } + SMB_NTSTATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY => { + Some("STATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY") + } + SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT => { + Some("STATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT") + } + SMB_NTSTATUS_GRAPHICS_VIDPN_SOURCE_IN_USE => Some("STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE"), + SMB_NTSTATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN => { + Some("STATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN") + } + SMB_NTSTATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL => { + Some("STATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL") + } + SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION => { + Some("STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION") + } + SMB_NTSTATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_INVALID_GAMMA_RAMP => Some("STATUS_GRAPHICS_INVALID_GAMMA_RAMP"), + SMB_NTSTATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_MODE_NOT_IN_MODESET => Some("STATUS_GRAPHICS_MODE_NOT_IN_MODESET"), + SMB_NTSTATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON => { + Some("STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON") + } + SMB_NTSTATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE => { + Some("STATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE") + } + SMB_NTSTATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE => { + Some("STATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE") + } + SMB_NTSTATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS => { + Some("STATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS") + } + SMB_NTSTATUS_GRAPHICS_INVALID_SCANLINE_ORDERING => { + Some("STATUS_GRAPHICS_INVALID_SCANLINE_ORDERING") + } + SMB_NTSTATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED => { + Some("STATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED") + } + SMB_NTSTATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS => { + Some("STATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS") + } + SMB_NTSTATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT => { + Some("STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM => { + Some("STATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN => { + Some("STATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN") + } + SMB_NTSTATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT => { + Some("STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT") + } + SMB_NTSTATUS_GRAPHICS_MAX_NUM_PATHS_REACHED => { + Some("STATUS_GRAPHICS_MAX_NUM_PATHS_REACHED") + } + SMB_NTSTATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION => { + Some("STATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION") + } + SMB_NTSTATUS_GRAPHICS_INVALID_CLIENT_TYPE => Some("STATUS_GRAPHICS_INVALID_CLIENT_TYPE"), + SMB_NTSTATUS_GRAPHICS_CLIENTVIDPN_NOT_SET => Some("STATUS_GRAPHICS_CLIENTVIDPN_NOT_SET"), + SMB_NTSTATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED => { + Some("STATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED") + } + SMB_NTSTATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_NOT_A_LINKED_ADAPTER => Some("STATUS_GRAPHICS_NOT_A_LINKED_ADAPTER"), + SMB_NTSTATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED => { + Some("STATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED") + } + SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED => { + Some("STATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED") + } + SMB_NTSTATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY => { + Some("STATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY") + } + SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_STARTED => { + Some("STATUS_GRAPHICS_CHAINLINKS_NOT_STARTED") + } + SMB_NTSTATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON => { + Some("STATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON") + } + SMB_NTSTATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE => { + Some("STATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE") + } + SMB_NTSTATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER => { + Some("STATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER") + } + SMB_NTSTATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED => { + Some("STATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED") + } + SMB_NTSTATUS_GRAPHICS_OPM_NOT_SUPPORTED => Some("STATUS_GRAPHICS_OPM_NOT_SUPPORTED"), + SMB_NTSTATUS_GRAPHICS_COPP_NOT_SUPPORTED => Some("STATUS_GRAPHICS_COPP_NOT_SUPPORTED"), + SMB_NTSTATUS_GRAPHICS_UAB_NOT_SUPPORTED => Some("STATUS_GRAPHICS_UAB_NOT_SUPPORTED"), + SMB_NTSTATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS => { + Some("STATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS") + } + SMB_NTSTATUS_GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL => { + Some("STATUS_GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL") + } + SMB_NTSTATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST => { + Some("STATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST") + } + SMB_NTSTATUS_GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME => { + Some("STATUS_GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME") + } + SMB_NTSTATUS_GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP => { + Some("STATUS_GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP") + } + SMB_NTSTATUS_GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_OPM_INVALID_POINTER => Some("STATUS_GRAPHICS_OPM_INVALID_POINTER"), + SMB_NTSTATUS_GRAPHICS_OPM_INTERNAL_ERROR => Some("STATUS_GRAPHICS_OPM_INTERNAL_ERROR"), + SMB_NTSTATUS_GRAPHICS_OPM_INVALID_HANDLE => Some("STATUS_GRAPHICS_OPM_INVALID_HANDLE"), + SMB_NTSTATUS_GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE => { + Some("STATUS_GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE") + } + SMB_NTSTATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH => { + Some("STATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH") + } + SMB_NTSTATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED => { + Some("STATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED") + } + SMB_NTSTATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED => { + Some("STATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED") + } + SMB_NTSTATUS_GRAPHICS_PVP_HFS_FAILED => Some("STATUS_GRAPHICS_PVP_HFS_FAILED"), + SMB_NTSTATUS_GRAPHICS_OPM_INVALID_SRM => Some("STATUS_GRAPHICS_OPM_INVALID_SRM"), + SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP => { + Some("STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP") + } + SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP => { + Some("STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP") + } + SMB_NTSTATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA => { + Some("STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA") + } + SMB_NTSTATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET => { + Some("STATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET") + } + SMB_NTSTATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH => { + Some("STATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH") + } + SMB_NTSTATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE => { + Some("STATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE") + } + SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS => { + Some("STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS") + } + SMB_NTSTATUS_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS => { + Some("STATUS_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS") + } + SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS => { + Some("STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS") + } + SMB_NTSTATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST => { + Some("STATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST") + } + SMB_NTSTATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR => { + Some("STATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR") + } + SMB_NTSTATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS => { + Some("STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS") + } + SMB_NTSTATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST => { + Some("STATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST") + } + SMB_NTSTATUS_GRAPHICS_I2C_NOT_SUPPORTED => Some("STATUS_GRAPHICS_I2C_NOT_SUPPORTED"), + SMB_NTSTATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST => { + Some("STATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST") + } + SMB_NTSTATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA => { + Some("STATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA") + } + SMB_NTSTATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA => { + Some("STATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA") + } + SMB_NTSTATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_DATA => Some("STATUS_GRAPHICS_DDCCI_INVALID_DATA"), + SMB_NTSTATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE => { + Some("STATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE") + } + SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING => { + Some("STATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING") + } + SMB_NTSTATUS_GRAPHICS_MCA_INTERNAL_ERROR => Some("STATUS_GRAPHICS_MCA_INTERNAL_ERROR"), + SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND => { + Some("STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND") + } + SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH => { + Some("STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH") + } + SMB_NTSTATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM => { + Some("STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM") + } + SMB_NTSTATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE => { + Some("STATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE") + } + SMB_NTSTATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS => { + Some("STATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS") + } + SMB_NTSTATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED => { + Some("STATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME => { + Some("STATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME") + } + SMB_NTSTATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP => { + Some("STATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP") + } + SMB_NTSTATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED => { + Some("STATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED") + } + SMB_NTSTATUS_GRAPHICS_INVALID_POINTER => Some("STATUS_GRAPHICS_INVALID_POINTER"), + SMB_NTSTATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE => { + Some("STATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE") + } + SMB_NTSTATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL => { + Some("STATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL") + } + SMB_NTSTATUS_GRAPHICS_INTERNAL_ERROR => Some("STATUS_GRAPHICS_INTERNAL_ERROR"), + SMB_NTSTATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS => { + Some("STATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS") + } + SMB_NTSTATUS_FVE_LOCKED_VOLUME => Some("STATUS_FVE_LOCKED_VOLUME"), + SMB_NTSTATUS_FVE_NOT_ENCRYPTED => Some("STATUS_FVE_NOT_ENCRYPTED"), + SMB_NTSTATUS_FVE_BAD_INFORMATION => Some("STATUS_FVE_BAD_INFORMATION"), + SMB_NTSTATUS_FVE_TOO_SMALL => Some("STATUS_FVE_TOO_SMALL"), + SMB_NTSTATUS_FVE_FAILED_WRONG_FS => Some("STATUS_FVE_FAILED_WRONG_FS"), + SMB_NTSTATUS_FVE_FAILED_BAD_FS => Some("STATUS_FVE_FAILED_BAD_FS"), + SMB_NTSTATUS_FVE_FS_NOT_EXTENDED => Some("STATUS_FVE_FS_NOT_EXTENDED"), + SMB_NTSTATUS_FVE_FS_MOUNTED => Some("STATUS_FVE_FS_MOUNTED"), + SMB_NTSTATUS_FVE_NO_LICENSE => Some("STATUS_FVE_NO_LICENSE"), + SMB_NTSTATUS_FVE_ACTION_NOT_ALLOWED => Some("STATUS_FVE_ACTION_NOT_ALLOWED"), + SMB_NTSTATUS_FVE_BAD_DATA => Some("STATUS_FVE_BAD_DATA"), + SMB_NTSTATUS_FVE_VOLUME_NOT_BOUND => Some("STATUS_FVE_VOLUME_NOT_BOUND"), + SMB_NTSTATUS_FVE_NOT_DATA_VOLUME => Some("STATUS_FVE_NOT_DATA_VOLUME"), + SMB_NTSTATUS_FVE_CONV_READ_ERROR => Some("STATUS_FVE_CONV_READ_ERROR"), + SMB_NTSTATUS_FVE_CONV_WRITE_ERROR => Some("STATUS_FVE_CONV_WRITE_ERROR"), + SMB_NTSTATUS_FVE_OVERLAPPED_UPDATE => Some("STATUS_FVE_OVERLAPPED_UPDATE"), + SMB_NTSTATUS_FVE_FAILED_SECTOR_SIZE => Some("STATUS_FVE_FAILED_SECTOR_SIZE"), + SMB_NTSTATUS_FVE_FAILED_AUTHENTICATION => Some("STATUS_FVE_FAILED_AUTHENTICATION"), + SMB_NTSTATUS_FVE_NOT_OS_VOLUME => Some("STATUS_FVE_NOT_OS_VOLUME"), + SMB_NTSTATUS_FVE_KEYFILE_NOT_FOUND => Some("STATUS_FVE_KEYFILE_NOT_FOUND"), + SMB_NTSTATUS_FVE_KEYFILE_INVALID => Some("STATUS_FVE_KEYFILE_INVALID"), + SMB_NTSTATUS_FVE_KEYFILE_NO_VMK => Some("STATUS_FVE_KEYFILE_NO_VMK"), + SMB_NTSTATUS_FVE_TPM_DISABLED => Some("STATUS_FVE_TPM_DISABLED"), + SMB_NTSTATUS_FVE_TPM_SRK_AUTH_NOT_ZERO => Some("STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO"), + SMB_NTSTATUS_FVE_TPM_INVALID_PCR => Some("STATUS_FVE_TPM_INVALID_PCR"), + SMB_NTSTATUS_FVE_TPM_NO_VMK => Some("STATUS_FVE_TPM_NO_VMK"), + SMB_NTSTATUS_FVE_PIN_INVALID => Some("STATUS_FVE_PIN_INVALID"), + SMB_NTSTATUS_FVE_AUTH_INVALID_APPLICATION => Some("STATUS_FVE_AUTH_INVALID_APPLICATION"), + SMB_NTSTATUS_FVE_AUTH_INVALID_CONFIG => Some("STATUS_FVE_AUTH_INVALID_CONFIG"), + SMB_NTSTATUS_FVE_DEBUGGER_ENABLED => Some("STATUS_FVE_DEBUGGER_ENABLED"), + SMB_NTSTATUS_FVE_DRY_RUN_FAILED => Some("STATUS_FVE_DRY_RUN_FAILED"), + SMB_NTSTATUS_FVE_BAD_METADATA_POINTER => Some("STATUS_FVE_BAD_METADATA_POINTER"), + SMB_NTSTATUS_FVE_OLD_METADATA_COPY => Some("STATUS_FVE_OLD_METADATA_COPY"), + SMB_NTSTATUS_FVE_REBOOT_REQUIRED => Some("STATUS_FVE_REBOOT_REQUIRED"), + SMB_NTSTATUS_FVE_RAW_ACCESS => Some("STATUS_FVE_RAW_ACCESS"), + SMB_NTSTATUS_FVE_RAW_BLOCKED => Some("STATUS_FVE_RAW_BLOCKED"), + SMB_NTSTATUS_FVE_NO_FEATURE_LICENSE => Some("STATUS_FVE_NO_FEATURE_LICENSE"), + SMB_NTSTATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED => { + Some("STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED") + } + SMB_NTSTATUS_FVE_CONV_RECOVERY_FAILED => Some("STATUS_FVE_CONV_RECOVERY_FAILED"), + SMB_NTSTATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG => Some("STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG"), + SMB_NTSTATUS_FVE_VOLUME_TOO_SMALL => Some("STATUS_FVE_VOLUME_TOO_SMALL"), + SMB_NTSTATUS_FWP_CALLOUT_NOT_FOUND => Some("STATUS_FWP_CALLOUT_NOT_FOUND"), + SMB_NTSTATUS_FWP_CONDITION_NOT_FOUND => Some("STATUS_FWP_CONDITION_NOT_FOUND"), + SMB_NTSTATUS_FWP_FILTER_NOT_FOUND => Some("STATUS_FWP_FILTER_NOT_FOUND"), + SMB_NTSTATUS_FWP_LAYER_NOT_FOUND => Some("STATUS_FWP_LAYER_NOT_FOUND"), + SMB_NTSTATUS_FWP_PROVIDER_NOT_FOUND => Some("STATUS_FWP_PROVIDER_NOT_FOUND"), + SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND => { + Some("STATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND") + } + SMB_NTSTATUS_FWP_SUBLAYER_NOT_FOUND => Some("STATUS_FWP_SUBLAYER_NOT_FOUND"), + SMB_NTSTATUS_FWP_NOT_FOUND => Some("STATUS_FWP_NOT_FOUND"), + SMB_NTSTATUS_FWP_ALREADY_EXISTS => Some("STATUS_FWP_ALREADY_EXISTS"), + SMB_NTSTATUS_FWP_IN_USE => Some("STATUS_FWP_IN_USE"), + SMB_NTSTATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS => { + Some("STATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS") + } + SMB_NTSTATUS_FWP_WRONG_SESSION => Some("STATUS_FWP_WRONG_SESSION"), + SMB_NTSTATUS_FWP_NO_TXN_IN_PROGRESS => Some("STATUS_FWP_NO_TXN_IN_PROGRESS"), + SMB_NTSTATUS_FWP_TXN_IN_PROGRESS => Some("STATUS_FWP_TXN_IN_PROGRESS"), + SMB_NTSTATUS_FWP_TXN_ABORTED => Some("STATUS_FWP_TXN_ABORTED"), + SMB_NTSTATUS_FWP_SESSION_ABORTED => Some("STATUS_FWP_SESSION_ABORTED"), + SMB_NTSTATUS_FWP_INCOMPATIBLE_TXN => Some("STATUS_FWP_INCOMPATIBLE_TXN"), + SMB_NTSTATUS_FWP_TIMEOUT => Some("STATUS_FWP_TIMEOUT"), + SMB_NTSTATUS_FWP_NET_EVENTS_DISABLED => Some("STATUS_FWP_NET_EVENTS_DISABLED"), + SMB_NTSTATUS_FWP_INCOMPATIBLE_LAYER => Some("STATUS_FWP_INCOMPATIBLE_LAYER"), + SMB_NTSTATUS_FWP_KM_CLIENTS_ONLY => Some("STATUS_FWP_KM_CLIENTS_ONLY"), + SMB_NTSTATUS_FWP_LIFETIME_MISMATCH => Some("STATUS_FWP_LIFETIME_MISMATCH"), + SMB_NTSTATUS_FWP_BUILTIN_OBJECT => Some("STATUS_FWP_BUILTIN_OBJECT"), + SMB_NTSTATUS_FWP_TOO_MANY_BOOTTIME_FILTERS => Some("STATUS_FWP_TOO_MANY_BOOTTIME_FILTERS"), + SMB_NTSTATUS_FWP_NOTIFICATION_DROPPED => Some("STATUS_FWP_NOTIFICATION_DROPPED"), + SMB_NTSTATUS_FWP_TRAFFIC_MISMATCH => Some("STATUS_FWP_TRAFFIC_MISMATCH"), + SMB_NTSTATUS_FWP_INCOMPATIBLE_SA_STATE => Some("STATUS_FWP_INCOMPATIBLE_SA_STATE"), + SMB_NTSTATUS_FWP_NULL_POINTER => Some("STATUS_FWP_NULL_POINTER"), + SMB_NTSTATUS_FWP_INVALID_ENUMERATOR => Some("STATUS_FWP_INVALID_ENUMERATOR"), + SMB_NTSTATUS_FWP_INVALID_FLAGS => Some("STATUS_FWP_INVALID_FLAGS"), + SMB_NTSTATUS_FWP_INVALID_NET_MASK => Some("STATUS_FWP_INVALID_NET_MASK"), + SMB_NTSTATUS_FWP_INVALID_RANGE => Some("STATUS_FWP_INVALID_RANGE"), + SMB_NTSTATUS_FWP_INVALID_INTERVAL => Some("STATUS_FWP_INVALID_INTERVAL"), + SMB_NTSTATUS_FWP_ZERO_LENGTH_ARRAY => Some("STATUS_FWP_ZERO_LENGTH_ARRAY"), + SMB_NTSTATUS_FWP_NULL_DISPLAY_NAME => Some("STATUS_FWP_NULL_DISPLAY_NAME"), + SMB_NTSTATUS_FWP_INVALID_ACTION_TYPE => Some("STATUS_FWP_INVALID_ACTION_TYPE"), + SMB_NTSTATUS_FWP_INVALID_WEIGHT => Some("STATUS_FWP_INVALID_WEIGHT"), + SMB_NTSTATUS_FWP_MATCH_TYPE_MISMATCH => Some("STATUS_FWP_MATCH_TYPE_MISMATCH"), + SMB_NTSTATUS_FWP_TYPE_MISMATCH => Some("STATUS_FWP_TYPE_MISMATCH"), + SMB_NTSTATUS_FWP_OUT_OF_BOUNDS => Some("STATUS_FWP_OUT_OF_BOUNDS"), + SMB_NTSTATUS_FWP_RESERVED => Some("STATUS_FWP_RESERVED"), + SMB_NTSTATUS_FWP_DUPLICATE_CONDITION => Some("STATUS_FWP_DUPLICATE_CONDITION"), + SMB_NTSTATUS_FWP_DUPLICATE_KEYMOD => Some("STATUS_FWP_DUPLICATE_KEYMOD"), + SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER => { + Some("STATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER") + } + SMB_NTSTATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER => { + Some("STATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER") + } + SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER => { + Some("STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER") + } + SMB_NTSTATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT => { + Some("STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT") + } + SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_METHOD => Some("STATUS_FWP_INCOMPATIBLE_AUTH_METHOD"), + SMB_NTSTATUS_FWP_INCOMPATIBLE_DH_GROUP => Some("STATUS_FWP_INCOMPATIBLE_DH_GROUP"), + SMB_NTSTATUS_FWP_EM_NOT_SUPPORTED => Some("STATUS_FWP_EM_NOT_SUPPORTED"), + SMB_NTSTATUS_FWP_NEVER_MATCH => Some("STATUS_FWP_NEVER_MATCH"), + SMB_NTSTATUS_FWP_PROVIDER_CONTEXT_MISMATCH => Some("STATUS_FWP_PROVIDER_CONTEXT_MISMATCH"), + SMB_NTSTATUS_FWP_INVALID_PARAMETER => Some("STATUS_FWP_INVALID_PARAMETER"), + SMB_NTSTATUS_FWP_TOO_MANY_SUBLAYERS => Some("STATUS_FWP_TOO_MANY_SUBLAYERS"), + SMB_NTSTATUS_FWP_CALLOUT_NOTIFICATION_FAILED => { + Some("STATUS_FWP_CALLOUT_NOTIFICATION_FAILED") + } + SMB_NTSTATUS_FWP_INCOMPATIBLE_AUTH_CONFIG => Some("STATUS_FWP_INCOMPATIBLE_AUTH_CONFIG"), + SMB_NTSTATUS_FWP_INCOMPATIBLE_CIPHER_CONFIG => { + Some("STATUS_FWP_INCOMPATIBLE_CIPHER_CONFIG") + } + SMB_NTSTATUS_FWP_DUPLICATE_AUTH_METHOD => Some("STATUS_FWP_DUPLICATE_AUTH_METHOD"), + SMB_NTSTATUS_FWP_TCPIP_NOT_READY => Some("STATUS_FWP_TCPIP_NOT_READY"), + SMB_NTSTATUS_FWP_INJECT_HANDLE_CLOSING => Some("STATUS_FWP_INJECT_HANDLE_CLOSING"), + SMB_NTSTATUS_FWP_INJECT_HANDLE_STALE => Some("STATUS_FWP_INJECT_HANDLE_STALE"), + SMB_NTSTATUS_FWP_CANNOT_PEND => Some("STATUS_FWP_CANNOT_PEND"), + SMB_NTSTATUS_NDIS_CLOSING => Some("STATUS_NDIS_CLOSING"), + SMB_NTSTATUS_NDIS_BAD_VERSION => Some("STATUS_NDIS_BAD_VERSION"), + SMB_NTSTATUS_NDIS_BAD_CHARACTERISTICS => Some("STATUS_NDIS_BAD_CHARACTERISTICS"), + SMB_NTSTATUS_NDIS_ADAPTER_NOT_FOUND => Some("STATUS_NDIS_ADAPTER_NOT_FOUND"), + SMB_NTSTATUS_NDIS_OPEN_FAILED => Some("STATUS_NDIS_OPEN_FAILED"), + SMB_NTSTATUS_NDIS_DEVICE_FAILED => Some("STATUS_NDIS_DEVICE_FAILED"), + SMB_NTSTATUS_NDIS_MULTICAST_FULL => Some("STATUS_NDIS_MULTICAST_FULL"), + SMB_NTSTATUS_NDIS_MULTICAST_EXISTS => Some("STATUS_NDIS_MULTICAST_EXISTS"), + SMB_NTSTATUS_NDIS_MULTICAST_NOT_FOUND => Some("STATUS_NDIS_MULTICAST_NOT_FOUND"), + SMB_NTSTATUS_NDIS_REQUEST_ABORTED => Some("STATUS_NDIS_REQUEST_ABORTED"), + SMB_NTSTATUS_NDIS_RESET_IN_PROGRESS => Some("STATUS_NDIS_RESET_IN_PROGRESS"), + SMB_NTSTATUS_NDIS_INVALID_PACKET => Some("STATUS_NDIS_INVALID_PACKET"), + SMB_NTSTATUS_NDIS_INVALID_DEVICE_REQUEST => Some("STATUS_NDIS_INVALID_DEVICE_REQUEST"), + SMB_NTSTATUS_NDIS_ADAPTER_NOT_READY => Some("STATUS_NDIS_ADAPTER_NOT_READY"), + SMB_NTSTATUS_NDIS_INVALID_LENGTH => Some("STATUS_NDIS_INVALID_LENGTH"), + SMB_NTSTATUS_NDIS_INVALID_DATA => Some("STATUS_NDIS_INVALID_DATA"), + SMB_NTSTATUS_NDIS_BUFFER_TOO_SHORT => Some("STATUS_NDIS_BUFFER_TOO_SHORT"), + SMB_NTSTATUS_NDIS_INVALID_OID => Some("STATUS_NDIS_INVALID_OID"), + SMB_NTSTATUS_NDIS_ADAPTER_REMOVED => Some("STATUS_NDIS_ADAPTER_REMOVED"), + SMB_NTSTATUS_NDIS_UNSUPPORTED_MEDIA => Some("STATUS_NDIS_UNSUPPORTED_MEDIA"), + SMB_NTSTATUS_NDIS_GROUP_ADDRESS_IN_USE => Some("STATUS_NDIS_GROUP_ADDRESS_IN_USE"), + SMB_NTSTATUS_NDIS_FILE_NOT_FOUND => Some("STATUS_NDIS_FILE_NOT_FOUND"), + SMB_NTSTATUS_NDIS_ERROR_READING_FILE => Some("STATUS_NDIS_ERROR_READING_FILE"), + SMB_NTSTATUS_NDIS_ALREADY_MAPPED => Some("STATUS_NDIS_ALREADY_MAPPED"), + SMB_NTSTATUS_NDIS_RESOURCE_CONFLICT => Some("STATUS_NDIS_RESOURCE_CONFLICT"), + SMB_NTSTATUS_NDIS_MEDIA_DISCONNECTED => Some("STATUS_NDIS_MEDIA_DISCONNECTED"), + SMB_NTSTATUS_NDIS_INVALID_ADDRESS => Some("STATUS_NDIS_INVALID_ADDRESS"), + SMB_NTSTATUS_NDIS_PAUSED => Some("STATUS_NDIS_PAUSED"), + SMB_NTSTATUS_NDIS_INTERFACE_NOT_FOUND => Some("STATUS_NDIS_INTERFACE_NOT_FOUND"), + SMB_NTSTATUS_NDIS_UNSUPPORTED_REVISION => Some("STATUS_NDIS_UNSUPPORTED_REVISION"), + SMB_NTSTATUS_NDIS_INVALID_PORT => Some("STATUS_NDIS_INVALID_PORT"), + SMB_NTSTATUS_NDIS_INVALID_PORT_STATE => Some("STATUS_NDIS_INVALID_PORT_STATE"), + SMB_NTSTATUS_NDIS_LOW_POWER_STATE => Some("STATUS_NDIS_LOW_POWER_STATE"), + SMB_NTSTATUS_NDIS_NOT_SUPPORTED => Some("STATUS_NDIS_NOT_SUPPORTED"), + SMB_NTSTATUS_NDIS_OFFLOAD_POLICY => Some("STATUS_NDIS_OFFLOAD_POLICY"), + SMB_NTSTATUS_NDIS_OFFLOAD_CONNECTION_REJECTED => { + Some("STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED") + } + SMB_NTSTATUS_NDIS_OFFLOAD_PATH_REJECTED => Some("STATUS_NDIS_OFFLOAD_PATH_REJECTED"), + SMB_NTSTATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED => { + Some("STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED") + } + SMB_NTSTATUS_NDIS_DOT11_MEDIA_IN_USE => Some("STATUS_NDIS_DOT11_MEDIA_IN_USE"), + SMB_NTSTATUS_NDIS_DOT11_POWER_STATE_INVALID => { + Some("STATUS_NDIS_DOT11_POWER_STATE_INVALID") + } + SMB_NTSTATUS_NDIS_PM_WOL_PATTERN_LIST_FULL => Some("STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL"), + SMB_NTSTATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL => { + Some("STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL") + } + SMB_NTSTATUS_IPSEC_BAD_SPI => Some("STATUS_IPSEC_BAD_SPI"), + SMB_NTSTATUS_IPSEC_SA_LIFETIME_EXPIRED => Some("STATUS_IPSEC_SA_LIFETIME_EXPIRED"), + SMB_NTSTATUS_IPSEC_WRONG_SA => Some("STATUS_IPSEC_WRONG_SA"), + SMB_NTSTATUS_IPSEC_REPLAY_CHECK_FAILED => Some("STATUS_IPSEC_REPLAY_CHECK_FAILED"), + SMB_NTSTATUS_IPSEC_INVALID_PACKET => Some("STATUS_IPSEC_INVALID_PACKET"), + SMB_NTSTATUS_IPSEC_INTEGRITY_CHECK_FAILED => Some("STATUS_IPSEC_INTEGRITY_CHECK_FAILED"), + SMB_NTSTATUS_IPSEC_CLEAR_TEXT_DROP => Some("STATUS_IPSEC_CLEAR_TEXT_DROP"), + SMB_NTSTATUS_IPSEC_AUTH_FIREWALL_DROP => Some("STATUS_IPSEC_AUTH_FIREWALL_DROP"), + SMB_NTSTATUS_IPSEC_THROTTLE_DROP => Some("STATUS_IPSEC_THROTTLE_DROP"), + SMB_NTSTATUS_IPSEC_DOSP_BLOCK => Some("STATUS_IPSEC_DOSP_BLOCK"), + SMB_NTSTATUS_IPSEC_DOSP_RECEIVED_MULTICAST => Some("STATUS_IPSEC_DOSP_RECEIVED_MULTICAST"), + SMB_NTSTATUS_IPSEC_DOSP_INVALID_PACKET => Some("STATUS_IPSEC_DOSP_INVALID_PACKET"), + SMB_NTSTATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED => { + Some("STATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED") + } + SMB_NTSTATUS_IPSEC_DOSP_MAX_ENTRIES => Some("STATUS_IPSEC_DOSP_MAX_ENTRIES"), + SMB_NTSTATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED => Some("STATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED"), + SMB_NTSTATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES => { + Some("STATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES") + } + SMB_NTSTATUS_VOLMGR_MIRROR_NOT_SUPPORTED => Some("STATUS_VOLMGR_MIRROR_NOT_SUPPORTED"), + SMB_NTSTATUS_VOLMGR_RAID5_NOT_SUPPORTED => Some("STATUS_VOLMGR_RAID5_NOT_SUPPORTED"), + SMB_NTSTATUS_VIRTDISK_PROVIDER_NOT_FOUND => Some("STATUS_VIRTDISK_PROVIDER_NOT_FOUND"), + SMB_NTSTATUS_VIRTDISK_NOT_VIRTUAL_DISK => Some("STATUS_VIRTDISK_NOT_VIRTUAL_DISK"), + SMB_NTSTATUS_VHD_PARENT_VHD_ACCESS_DENIED => Some("STATUS_VHD_PARENT_VHD_ACCESS_DENIED"), + SMB_NTSTATUS_VHD_CHILD_PARENT_SIZE_MISMATCH => { + Some("STATUS_VHD_CHILD_PARENT_SIZE_MISMATCH") + } + SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED => { + Some("STATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED") + } + SMB_NTSTATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT => { + Some("STATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT") + } + _ => None, } } - diff --git a/rust/src/snmp/detect.rs b/rust/src/snmp/detect.rs index bb4ffd12c3ba..7661d3ce7473 100644 --- a/rust/src/snmp/detect.rs +++ b/rust/src/snmp/detect.rs @@ -20,23 +20,23 @@ use crate::snmp::snmp::SNMPTransaction; #[no_mangle] -pub unsafe extern "C" fn rs_snmp_tx_get_version(tx: &mut SNMPTransaction, version: *mut u32) { +pub unsafe extern fn rs_snmp_tx_get_version(tx: &mut SNMPTransaction, version: *mut u32) { debug_assert!(tx.version != 0, "SNMP version is 0"); *version = tx.version; } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_tx_get_community( +pub unsafe extern fn rs_snmp_tx_get_community( tx: &mut SNMPTransaction, buf: *mut *const u8, len: *mut u32, ) { - if let Some(ref c) = tx.community { + if let Some(ref c) = tx.community { *buf = c.as_ptr(); *len = c.len() as u32; } } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_tx_get_pdu_type(tx: &mut SNMPTransaction, pdu_type: *mut u32) { +pub unsafe extern fn rs_snmp_tx_get_pdu_type(tx: &mut SNMPTransaction, pdu_type: *mut u32) { match tx.info { Some(ref info) => { *pdu_type = info.pdu_type.0; @@ -48,10 +48,10 @@ pub unsafe extern "C" fn rs_snmp_tx_get_pdu_type(tx: &mut SNMPTransaction, pdu_t } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_tx_get_usm( +pub unsafe extern fn rs_snmp_tx_get_usm( tx: &mut SNMPTransaction, buf: *mut *const u8, len: *mut u32, ) { - if let Some(ref c) = tx.usm { + if let Some(ref c) = tx.usm { *buf = c.as_ptr(); *len = c.len() as u32; } diff --git a/rust/src/snmp/log.rs b/rust/src/snmp/log.rs index 5707f30ccb4e..20f45c04828a 100644 --- a/rust/src/snmp/log.rs +++ b/rust/src/snmp/log.rs @@ -19,10 +19,10 @@ use crate::jsonbuilder::{JsonBuilder, JsonError}; use crate::snmp::snmp::SNMPTransaction; -use crate::snmp::snmp_parser::{NetworkAddress,PduType}; +use crate::snmp::snmp_parser::{NetworkAddress, PduType}; use std::borrow::Cow; -fn str_of_pdu_type(t:&PduType) -> Cow { +fn str_of_pdu_type(t: &PduType) -> Cow { match t { &PduType::GetRequest => Cow::Borrowed("get_request"), &PduType::GetNextRequest => Cow::Borrowed("get_next_request"), @@ -37,8 +37,7 @@ fn str_of_pdu_type(t:&PduType) -> Cow { } } -fn snmp_log_response(jsb: &mut JsonBuilder, tx: &mut SNMPTransaction) -> Result<(), JsonError> -{ +fn snmp_log_response(jsb: &mut JsonBuilder, tx: &mut SNMPTransaction) -> Result<(), JsonError> { jsb.open_object("snmp")?; jsb.set_uint("version", tx.version as u64)?; if tx.encrypted { @@ -53,7 +52,9 @@ fn snmp_log_response(jsb: &mut JsonBuilder, tx: &mut SNMPTransaction) -> Result< jsb.set_string("trap_type", &format!("{:?}", trap_type))?; jsb.set_string("trap_oid", &oid.to_string())?; match address { - NetworkAddress::IPv4(ip) => {jsb.set_string("trap_address", &ip.to_string())?;}, + NetworkAddress::IPv4(ip) => { + jsb.set_string("trap_address", &ip.to_string())?; + } } } if !info.vars.is_empty() { @@ -77,7 +78,6 @@ fn snmp_log_response(jsb: &mut JsonBuilder, tx: &mut SNMPTransaction) -> Result< } #[no_mangle] -pub extern "C" fn rs_snmp_log_json_response(tx: &mut SNMPTransaction, jsb: &mut JsonBuilder) -> bool -{ +pub extern fn rs_snmp_log_json_response(tx: &mut SNMPTransaction, jsb: &mut JsonBuilder) -> bool { snmp_log_response(jsb, tx).is_ok() } diff --git a/rust/src/snmp/mod.rs b/rust/src/snmp/mod.rs index 7c6ceb35884b..b8c769f45855 100644 --- a/rust/src/snmp/mod.rs +++ b/rust/src/snmp/mod.rs @@ -21,6 +21,6 @@ extern crate snmp_parser; -pub mod snmp; -pub mod log; pub mod detect; +pub mod log; +pub mod snmp; diff --git a/rust/src/snmp/snmp.rs b/rust/src/snmp/snmp.rs index a4481f4bc191..daaa99a67a01 100644 --- a/rust/src/snmp/snmp.rs +++ b/rust/src/snmp/snmp.rs @@ -17,17 +17,17 @@ // written by Pierre Chifflier -use crate::snmp::snmp_parser::*; -use crate::core::{self, *}; use crate::applayer::{self, *}; +use crate::core::{self, *}; +use crate::snmp::snmp_parser::*; use std; use std::ffi::CString; use asn1_rs::Oid; use der_parser::ber::BerObjectContent; use der_parser::der::parse_der_sequence; +use nom7::error::{make_error, ErrorKind}; use nom7::{Err, IResult}; -use nom7::error::{ErrorKind, make_error}; #[derive(AppLayerEvent)] pub enum SNMPEvent { @@ -55,7 +55,7 @@ pub struct SNMPPduInfo<'a> { pub err: ErrorStatus, - pub trap_type: Option<(TrapType,Oid<'a>,NetworkAddress)>, + pub trap_type: Option<(TrapType, Oid<'a>, NetworkAddress)>, pub vars: Vec>, } @@ -96,11 +96,11 @@ impl<'a> SNMPState<'a> { impl<'a> Default for SNMPPduInfo<'a> { fn default() -> SNMPPduInfo<'a> { - SNMPPduInfo{ + SNMPPduInfo { pdu_type: PduType(0), err: ErrorStatus::NoError, trap_type: None, - vars: Vec::new() + vars: Vec::new(), } } } @@ -124,11 +124,10 @@ impl<'a> SNMPState<'a> { match *pdu { SnmpPdu::Generic(ref pdu) => { pdu_info.err = pdu.err; - }, - SnmpPdu::Bulk(_) => { - }, - SnmpPdu::TrapV1(ref t) => { - pdu_info.trap_type = Some((t.generic_trap,t.enterprise.clone(),t.agent_addr)); + } + SnmpPdu::Bulk(_) => {} + SnmpPdu::TrapV1(ref t) => { + pdu_info.trap_type = Some((t.generic_trap, t.enterprise.clone(), t.agent_addr)); } } @@ -142,7 +141,11 @@ impl<'a> SNMPState<'a> { let mut tx = self.new_tx(_direction); // in the message, version is encoded as 0 (version 1) or 1 (version 2) if self.version != msg.version + 1 { - SCLogDebug!("SNMP version mismatch: expected {}, received {}", self.version, msg.version+1); + SCLogDebug!( + "SNMP version mismatch: expected {}, received {}", + self.version, + msg.version + 1 + ); self.set_event_tx(&mut tx, SNMPEvent::VersionMismatch); } self.add_pdu_info(&msg.pdu, &mut tx); @@ -154,22 +157,26 @@ impl<'a> SNMPState<'a> { fn handle_snmp_v3(&mut self, msg: SnmpV3Message<'a>, _direction: Direction) -> i32 { let mut tx = self.new_tx(_direction); if self.version != msg.version { - SCLogDebug!("SNMP version mismatch: expected {}, received {}", self.version, msg.version); + SCLogDebug!( + "SNMP version mismatch: expected {}, received {}", + self.version, + msg.version + ); self.set_event_tx(&mut tx, SNMPEvent::VersionMismatch); } match msg.data { ScopedPduData::Plaintext(pdu) => { self.add_pdu_info(&pdu.data, &mut tx); - }, - _ => { + } + _ => { tx.encrypted = true; } } match msg.security_params { SecurityParameters::USM(usm) => { tx.usm = Some(usm.msg_user_name); - }, - _ => { + } + _ => { self.set_event_tx(&mut tx, SNMPEvent::UnknownSecurityModel); } } @@ -187,14 +194,15 @@ impl<'a> SNMPState<'a> { } } match parse_snmp_generic_message(i) { - Ok((_rem,SnmpGenericMessage::V1(msg))) | - Ok((_rem,SnmpGenericMessage::V2(msg))) => self.handle_snmp_v12(msg, direction), - Ok((_rem,SnmpGenericMessage::V3(msg))) => self.handle_snmp_v3(msg, direction), + Ok((_rem, SnmpGenericMessage::V1(msg))) | Ok((_rem, SnmpGenericMessage::V2(msg))) => { + self.handle_snmp_v12(msg, direction) + } + Ok((_rem, SnmpGenericMessage::V3(msg))) => self.handle_snmp_v3(msg, direction), Err(_e) => { SCLogDebug!("parse_snmp failed: {:?}", _e); self.set_event(SNMPEvent::MalformedData); -1 - }, + } } } @@ -210,7 +218,10 @@ impl<'a> SNMPState<'a> { } fn get_tx_by_id(&mut self, tx_id: u64) -> Option<&SNMPTransaction> { - self.transactions.iter().rev().find(|&tx| tx.id == tx_id + 1) + self.transactions + .iter() + .rev() + .find(|&tx| tx.id == tx_id + 1) } fn free_tx(&mut self, tx_id: u64) { @@ -250,7 +261,9 @@ impl<'a> SNMPTransaction<'a> { /// Returns *mut SNMPState #[no_mangle] -pub extern "C" fn rs_snmp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_snmp_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = SNMPState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; @@ -259,151 +272,150 @@ pub extern "C" fn rs_snmp_state_new(_orig_state: *mut std::os::raw::c_void, _ori /// Params: /// - state: *mut SNMPState as void pointer #[no_mangle] -pub extern "C" fn rs_snmp_state_free(state: *mut std::os::raw::c_void) { - let mut snmp_state = unsafe{ Box::from_raw(state as *mut SNMPState) }; +pub extern fn rs_snmp_state_free(state: *mut std::os::raw::c_void) { + let mut snmp_state = unsafe { Box::from_raw(state as *mut SNMPState) }; snmp_state.free(); } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_parse_request(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { - let state = cast_pointer!(state,SNMPState); - state.parse(stream_slice.as_slice(), Direction::ToServer).into() +pub unsafe extern fn rs_snmp_parse_request( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { + let state = cast_pointer!(state, SNMPState); + state + .parse(stream_slice.as_slice(), Direction::ToServer) + .into() } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_parse_response(_flow: *const core::Flow, - state: *mut std::os::raw::c_void, - _pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void, - ) -> AppLayerResult { - let state = cast_pointer!(state,SNMPState); - state.parse(stream_slice.as_slice(), Direction::ToClient).into() +pub unsafe extern fn rs_snmp_parse_response( + _flow: *const core::Flow, state: *mut std::os::raw::c_void, _pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, +) -> AppLayerResult { + let state = cast_pointer!(state, SNMPState); + state + .parse(stream_slice.as_slice(), Direction::ToClient) + .into() } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_state_get_tx(state: *mut std::os::raw::c_void, - tx_id: u64) - -> *mut std::os::raw::c_void -{ - let state = cast_pointer!(state,SNMPState); +pub unsafe extern fn rs_snmp_state_get_tx( + state: *mut std::os::raw::c_void, tx_id: u64, +) -> *mut std::os::raw::c_void { + let state = cast_pointer!(state, SNMPState); match state.get_tx_by_id(tx_id) { Some(tx) => tx as *const _ as *mut _, - None => std::ptr::null_mut(), + None => std::ptr::null_mut(), } } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_state_get_tx_count(state: *mut std::os::raw::c_void) - -> u64 -{ - let state = cast_pointer!(state,SNMPState); +pub unsafe extern fn rs_snmp_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { + let state = cast_pointer!(state, SNMPState); state.tx_id } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_state_tx_free(state: *mut std::os::raw::c_void, - tx_id: u64) -{ - let state = cast_pointer!(state,SNMPState); +pub unsafe extern fn rs_snmp_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { + let state = cast_pointer!(state, SNMPState); state.free_tx(tx_id); } #[no_mangle] -pub extern "C" fn rs_snmp_tx_get_alstate_progress(_tx: *mut std::os::raw::c_void, - _direction: u8) - -> std::os::raw::c_int -{ +pub extern fn rs_snmp_tx_get_alstate_progress( + _tx: *mut std::os::raw::c_void, _direction: u8, +) -> std::os::raw::c_int { 1 } -static mut ALPROTO_SNMP : AppProto = ALPROTO_UNKNOWN; +static mut ALPROTO_SNMP: AppProto = ALPROTO_UNKNOWN; // Read PDU sequence and extract version, if similar to SNMP definition -fn parse_pdu_envelope_version(i:&[u8]) -> IResult<&[u8],u32> { +fn parse_pdu_envelope_version(i: &[u8]) -> IResult<&[u8], u32> { match parse_der_sequence(i) { - Ok((_,x)) => { + Ok((_, x)) => { #[allow(clippy::single_match)] match x.content { BerObjectContent::Sequence(ref v) => { if v.len() == 3 { - match v[0].as_u32() { - Ok(0) => { return Ok((i,1)); }, // possibly SNMPv1 - Ok(1) => { return Ok((i,2)); }, // possibly SNMPv2c - _ => () + match v[0].as_u32() { + Ok(0) => { + return Ok((i, 1)); + } // possibly SNMPv1 + Ok(1) => { + return Ok((i, 2)); + } // possibly SNMPv2c + _ => (), } } else if v.len() == 4 && v[0].as_u32() == Ok(3) { - return Ok((i,3)); // possibly SNMPv3 + return Ok((i, 3)); // possibly SNMPv3 } - }, - _ => () + } + _ => (), }; Err(Err::Error(make_error(i, ErrorKind::Verify))) - }, + } Err(Err::Incomplete(i)) => Err(Err::Incomplete(i)), - Err(Err::Failure(_)) | - Err(Err::Error(_)) => Err(Err::Error(make_error(i,ErrorKind::Verify))) + Err(Err::Failure(_)) | Err(Err::Error(_)) => { + Err(Err::Error(make_error(i, ErrorKind::Verify))) + } } } #[no_mangle] -pub unsafe extern "C" fn rs_snmp_probing_parser(_flow: *const Flow, - _direction: u8, - input:*const u8, - input_len: u32, - _rdir: *mut u8) -> AppProto { - let slice = build_slice!(input,input_len as usize); +pub unsafe extern fn rs_snmp_probing_parser( + _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, +) -> AppProto { + let slice = build_slice!(input, input_len as usize); let alproto = ALPROTO_SNMP; - if slice.len() < 4 { return ALPROTO_FAILED; } + if slice.len() < 4 { + return ALPROTO_FAILED; + } match parse_pdu_envelope_version(slice) { - Ok((_,_)) => alproto, + Ok((_, _)) => alproto, Err(Err::Incomplete(_)) => ALPROTO_UNKNOWN, - _ => ALPROTO_FAILED, + _ => ALPROTO_FAILED, } } export_tx_data_get!(rs_snmp_get_tx_data, SNMPTransaction); export_state_data_get!(rs_snmp_get_state_data, SNMPState); -const PARSER_NAME : &[u8] = b"snmp\0"; +const PARSER_NAME: &[u8] = b"snmp\0"; #[no_mangle] -pub unsafe extern "C" fn rs_register_snmp_parser() { +pub unsafe extern fn rs_register_snmp_parser() { let default_port = CString::new("161").unwrap(); let mut parser = RustParser { - name : PARSER_NAME.as_ptr() as *const std::os::raw::c_char, - default_port : default_port.as_ptr(), - ipproto : core::IPPROTO_UDP, - probe_ts : Some(rs_snmp_probing_parser), - probe_tc : Some(rs_snmp_probing_parser), - min_depth : 0, - max_depth : 16, - state_new : rs_snmp_state_new, - state_free : rs_snmp_state_free, - tx_free : rs_snmp_state_tx_free, - parse_ts : rs_snmp_parse_request, - parse_tc : rs_snmp_parse_response, - get_tx_count : rs_snmp_state_get_tx_count, - get_tx : rs_snmp_state_get_tx, - tx_comp_st_ts : 1, - tx_comp_st_tc : 1, - tx_get_progress : rs_snmp_tx_get_alstate_progress, - get_eventinfo : Some(SNMPEvent::get_event_info), - get_eventinfo_byid : Some(SNMPEvent::get_event_info_by_id), - localstorage_new : None, - localstorage_free : None, - get_tx_files : None, - get_tx_iterator : Some(applayer::state_get_tx_iterator::), - get_tx_data : rs_snmp_get_tx_data, - get_state_data : rs_snmp_get_state_data, - apply_tx_config : None, - flags : 0, - truncate : None, + name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, + default_port: default_port.as_ptr(), + ipproto: core::IPPROTO_UDP, + probe_ts: Some(rs_snmp_probing_parser), + probe_tc: Some(rs_snmp_probing_parser), + min_depth: 0, + max_depth: 16, + state_new: rs_snmp_state_new, + state_free: rs_snmp_state_free, + tx_free: rs_snmp_state_tx_free, + parse_ts: rs_snmp_parse_request, + parse_tc: rs_snmp_parse_response, + get_tx_count: rs_snmp_state_get_tx_count, + get_tx: rs_snmp_state_get_tx, + tx_comp_st_ts: 1, + tx_comp_st_tc: 1, + tx_get_progress: rs_snmp_tx_get_alstate_progress, + get_eventinfo: Some(SNMPEvent::get_event_info), + get_eventinfo_byid: Some(SNMPEvent::get_event_info_by_id), + localstorage_new: None, + localstorage_free: None, + get_tx_files: None, + get_tx_iterator: Some(applayer::state_get_tx_iterator::), + get_tx_data: rs_snmp_get_tx_data, + get_state_data: rs_snmp_get_state_data, + apply_tx_config: None, + flags: 0, + truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/ssh/detect.rs b/rust/src/ssh/detect.rs index 6aa18cdac781..4061757d2ec1 100644 --- a/rust/src/ssh/detect.rs +++ b/rust/src/ssh/detect.rs @@ -20,7 +20,7 @@ use crate::core::Direction; use std::ptr; #[no_mangle] -pub unsafe extern "C" fn rs_ssh_tx_get_protocol( +pub unsafe extern fn rs_ssh_tx_get_protocol( tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8, ) -> u8 { let tx = cast_pointer!(tx, SSHTransaction); @@ -49,7 +49,7 @@ pub unsafe extern "C" fn rs_ssh_tx_get_protocol( } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_tx_get_software( +pub unsafe extern fn rs_ssh_tx_get_software( tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8, ) -> u8 { let tx = cast_pointer!(tx, SSHTransaction); @@ -78,11 +78,8 @@ pub unsafe extern "C" fn rs_ssh_tx_get_software( } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_tx_get_hassh( - tx: *mut std::os::raw::c_void, - buffer: *mut *const u8, - buffer_len: *mut u32, - direction: u8, +pub unsafe extern fn rs_ssh_tx_get_hassh( + tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8, ) -> u8 { let tx = cast_pointer!(tx, SSHTransaction); match direction.into() { @@ -110,11 +107,8 @@ pub unsafe extern "C" fn rs_ssh_tx_get_hassh( } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_tx_get_hassh_string( - tx: *mut std::os::raw::c_void, - buffer: *mut *const u8, - buffer_len: *mut u32, - direction: u8, +pub unsafe extern fn rs_ssh_tx_get_hassh_string( + tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8, ) -> u8 { let tx = cast_pointer!(tx, SSHTransaction); match direction.into() { diff --git a/rust/src/ssh/logger.rs b/rust/src/ssh/logger.rs index 008c6cb4517a..d45e9af4fb52 100644 --- a/rust/src/ssh/logger.rs +++ b/rust/src/ssh/logger.rs @@ -64,7 +64,7 @@ fn log_ssh(tx: &SSHTransaction, js: &mut JsonBuilder) -> Result } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_log_json(tx: *mut std::os::raw::c_void, js: &mut JsonBuilder) -> bool { +pub unsafe extern fn rs_ssh_log_json(tx: *mut std::os::raw::c_void, js: &mut JsonBuilder) -> bool { let tx = cast_pointer!(tx, SSHTransaction); if let Ok(x) = log_ssh(tx, js) { return x; diff --git a/rust/src/ssh/parser.rs b/rust/src/ssh/parser.rs index bfad8c005a9d..7a5d0ee6c26c 100644 --- a/rust/src/ssh/parser.rs +++ b/rust/src/ssh/parser.rs @@ -30,18 +30,18 @@ use std::fmt; #[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum MessageCode { - Disconnect, - Ignore, - Unimplemented, - Debug, - ServiceRequest, - ServiceAccept, - Kexinit, - NewKeys, - KexdhInit, - KexdhReply, - - Undefined(u8), + Disconnect, + Ignore, + Unimplemented, + Debug, + ServiceRequest, + ServiceAccept, + Kexinit, + NewKeys, + KexdhInit, + KexdhReply, + + Undefined(u8), } impl MessageCode { @@ -79,9 +79,8 @@ pub fn ssh_parse_line(i: &[u8]) -> IResult<&[u8], &[u8]> { } terminated( take_while(is_not_lineend), - alt(( tag("\n"), tag("\r\n"), parser - )) - )(i) + alt((tag("\n"), tag("\r\n"), parser)), + )(i) } #[derive(PartialEq, Eq)] @@ -340,100 +339,111 @@ mod tests { } #[test] fn test_parse_key_exchange() { - let client_key_exchange = [0x18 ,0x70 ,0xCB ,0xA4 ,0xA3 ,0xD4 ,0xDC ,0x88 ,0x6F - ,0xFD ,0x76 ,0x06 ,0xCF ,0x36 ,0x1B ,0xC6 ,0x00 ,0x00 ,0x01 ,0x0D ,0x63 ,0x75 ,0x72 ,0x76 - ,0x65 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 ,0x36 ,0x2C ,0x63 - ,0x75 ,0x72 ,0x76 ,0x65 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 - ,0x36 ,0x40 ,0x6C ,0x69 ,0x62 ,0x73 ,0x73 ,0x68 ,0x2E ,0x6F ,0x72 ,0x67 ,0x2C ,0x65 ,0x63 - ,0x64 ,0x68 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x32 ,0x35 - ,0x36 ,0x2C ,0x65 ,0x63 ,0x64 ,0x68 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 - ,0x74 ,0x70 ,0x33 ,0x38 ,0x34 ,0x2C ,0x65 ,0x63 ,0x64 ,0x68 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 - ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x35 ,0x32 ,0x31 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 - ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 - ,0x2D ,0x65 ,0x78 ,0x63 ,0x68 ,0x61 ,0x6E ,0x67 ,0x65 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 - ,0x36 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x36 ,0x2D ,0x73 ,0x68 ,0x61 ,0x35 ,0x31 - ,0x32 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x38 ,0x2D ,0x73 ,0x68 ,0x61 ,0x35 ,0x31 - ,0x32 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x34 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 - ,0x36 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x34 ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x2C - ,0x65 ,0x78 ,0x74 ,0x2D ,0x69 ,0x6E ,0x66 ,0x6F ,0x2D ,0x63 ,0x00 ,0x00 ,0x01 ,0x66 ,0x65 - ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 - ,0x32 ,0x35 ,0x36 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 - ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x33 ,0x38 ,0x34 ,0x2D - ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 - ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 - ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x35 ,0x32 ,0x31 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 - ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F - ,0x6D ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 - ,0x73 ,0x74 ,0x70 ,0x32 ,0x35 ,0x36 ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 - ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x33 ,0x38 ,0x34 ,0x2C ,0x65 ,0x63 ,0x64 - ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x35 ,0x32 - ,0x31 ,0x2C ,0x73 ,0x73 ,0x68 ,0x2D ,0x65 ,0x64 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2D ,0x63 - ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 - ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 - ,0x31 ,0x32 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 - ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 - ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 ,0x36 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 - ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x73 ,0x73 - ,0x68 ,0x2D ,0x72 ,0x73 ,0x61 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x73 ,0x73 ,0x68 - ,0x2D ,0x65 ,0x64 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 - ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 - ,0x2D ,0x32 ,0x35 ,0x36 ,0x2C ,0x73 ,0x73 ,0x68 ,0x2D ,0x72 ,0x73 ,0x61 ,0x00 ,0x00 ,0x00 - ,0x6C ,0x63 ,0x68 ,0x61 ,0x63 ,0x68 ,0x61 ,0x32 ,0x30 ,0x2D ,0x70 ,0x6F ,0x6C ,0x79 ,0x31 - ,0x33 ,0x30 ,0x35 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D - ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x32 ,0x38 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 - ,0x31 ,0x39 ,0x32 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x32 ,0x35 ,0x36 ,0x2D - ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x32 ,0x38 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x61 ,0x65 ,0x73 - ,0x32 ,0x35 ,0x36 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 - ,0x2E ,0x63 ,0x6F ,0x6D ,0x00 ,0x00 ,0x00 ,0x6C ,0x63 ,0x68 ,0x61 ,0x63 ,0x68 ,0x61 ,0x32 - ,0x30 ,0x2D ,0x70 ,0x6F ,0x6C ,0x79 ,0x31 ,0x33 ,0x30 ,0x35 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E - ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x32 ,0x38 ,0x2D - ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x39 ,0x32 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C - ,0x61 ,0x65 ,0x73 ,0x32 ,0x35 ,0x36 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 - ,0x32 ,0x38 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x61 ,0x65 ,0x73 ,0x32 ,0x35 ,0x36 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x00 ,0x00 ,0x00 ,0xD5 - ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 - ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x31 - ,0x32 ,0x38 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 - ,0x35 ,0x36 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 - ,0x31 ,0x32 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x2D ,0x65 - ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C - ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 - ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x31 ,0x32 ,0x38 ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 ,0x36 ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D - ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 - ,0x68 ,0x61 ,0x31 ,0x00 ,0x00 ,0x00 ,0xD5 ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x2D - ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D - ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x31 ,0x32 ,0x38 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 ,0x36 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 - ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 - ,0x63 ,0x2D ,0x31 ,0x32 ,0x38 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 - ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 - ,0x36 ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 - ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x00 ,0x00 ,0x00 ,0x1A ,0x6E - ,0x6F ,0x6E ,0x65 ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 - ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x00 ,0x00 ,0x00 ,0x1A ,0x6E - ,0x6F ,0x6E ,0x65 ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 - ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 - ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00]; - let cookie = [0x18, 0x70, 0xcb, 0xa4, 0xa3, 0xd4, 0xdc, 0x88, 0x6f, 0xfd, 0x76, 0x06, 0xcf, 0x36, 0x1b, 0xc6]; + let client_key_exchange = [ + 0x18, 0x70, 0xCB, 0xA4, 0xA3, 0xD4, 0xDC, 0x88, 0x6F, 0xFD, 0x76, 0x06, 0xCF, 0x36, + 0x1B, 0xC6, 0x00, 0x00, 0x01, 0x0D, 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, + 0x31, 0x39, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2C, 0x63, 0x75, 0x72, 0x76, + 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x40, + 0x6C, 0x69, 0x62, 0x73, 0x73, 0x68, 0x2E, 0x6F, 0x72, 0x67, 0x2C, 0x65, 0x63, 0x64, + 0x68, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, + 0x36, 0x2C, 0x65, 0x63, 0x64, 0x68, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, + 0x73, 0x74, 0x70, 0x33, 0x38, 0x34, 0x2C, 0x65, 0x63, 0x64, 0x68, 0x2D, 0x73, 0x68, + 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, 0x31, 0x2C, 0x64, 0x69, + 0x66, 0x66, 0x69, 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, + 0x72, 0x6F, 0x75, 0x70, 0x2D, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6E, 0x67, 0x65, 0x2D, + 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2C, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2D, + 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, 0x72, 0x6F, 0x75, 0x70, 0x31, + 0x36, 0x2D, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2C, 0x64, 0x69, 0x66, 0x66, 0x69, + 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, 0x72, 0x6F, 0x75, + 0x70, 0x31, 0x38, 0x2D, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2C, 0x64, 0x69, 0x66, + 0x66, 0x69, 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, 0x72, + 0x6F, 0x75, 0x70, 0x31, 0x34, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2C, 0x64, + 0x69, 0x66, 0x66, 0x69, 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, + 0x67, 0x72, 0x6F, 0x75, 0x70, 0x31, 0x34, 0x2D, 0x73, 0x68, 0x61, 0x31, 0x2C, 0x65, + 0x78, 0x74, 0x2D, 0x69, 0x6E, 0x66, 0x6F, 0x2D, 0x63, 0x00, 0x00, 0x01, 0x66, 0x65, + 0x63, 0x64, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, + 0x70, 0x32, 0x35, 0x36, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, + 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x65, 0x63, + 0x64, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, + 0x33, 0x38, 0x34, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, + 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x65, 0x63, 0x64, + 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x35, + 0x32, 0x31, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, + 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x65, 0x63, 0x64, 0x73, + 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, + 0x36, 0x2C, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, + 0x69, 0x73, 0x74, 0x70, 0x33, 0x38, 0x34, 0x2C, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2D, + 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, 0x31, 0x2C, + 0x73, 0x73, 0x68, 0x2D, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2D, 0x63, 0x65, + 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x72, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, + 0x35, 0x31, 0x32, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, + 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x72, 0x73, 0x61, + 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2D, 0x63, 0x65, 0x72, 0x74, + 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, + 0x6F, 0x6D, 0x2C, 0x73, 0x73, 0x68, 0x2D, 0x72, 0x73, 0x61, 0x2D, 0x63, 0x65, 0x72, + 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, + 0x63, 0x6F, 0x6D, 0x2C, 0x73, 0x73, 0x68, 0x2D, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, + 0x39, 0x2C, 0x72, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x35, 0x31, 0x32, + 0x2C, 0x72, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2C, + 0x73, 0x73, 0x68, 0x2D, 0x72, 0x73, 0x61, 0x00, 0x00, 0x00, 0x6C, 0x63, 0x68, 0x61, + 0x63, 0x68, 0x61, 0x32, 0x30, 0x2D, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, + 0x39, 0x32, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, + 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x67, 0x63, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, 0x67, 0x63, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, + 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x00, 0x00, 0x6C, 0x63, 0x68, 0x61, + 0x63, 0x68, 0x61, 0x32, 0x30, 0x2D, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, + 0x39, 0x32, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, + 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x67, 0x63, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, 0x67, 0x63, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, + 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x00, 0x00, 0xD5, 0x75, 0x6D, 0x61, + 0x63, 0x2D, 0x36, 0x34, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, + 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x31, 0x32, + 0x38, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, + 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, + 0x32, 0x35, 0x36, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, + 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, + 0x32, 0x2D, 0x35, 0x31, 0x32, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, + 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, + 0x68, 0x61, 0x31, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, + 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x36, 0x34, 0x40, + 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, + 0x61, 0x63, 0x2D, 0x31, 0x32, 0x38, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, + 0x2D, 0x32, 0x35, 0x36, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, + 0x2D, 0x35, 0x31, 0x32, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x31, + 0x00, 0x00, 0x00, 0xD5, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x36, 0x34, 0x2D, 0x65, 0x74, + 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, + 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x31, 0x32, 0x38, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, + 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, + 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2D, 0x65, 0x74, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, + 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x35, 0x31, 0x32, 0x2D, 0x65, + 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, + 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x31, 0x2D, 0x65, 0x74, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, + 0x6D, 0x61, 0x63, 0x2D, 0x36, 0x34, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x31, 0x32, 0x38, 0x40, + 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, + 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2C, 0x68, 0x6D, + 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x35, 0x31, 0x32, 0x2C, 0x68, 0x6D, + 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0x1A, 0x6E, 0x6F, 0x6E, + 0x65, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x00, 0x00, 0x00, 0x1A, 0x6E, + 0x6F, 0x6E, 0x65, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, + 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ]; + let cookie = [ + 0x18, 0x70, 0xcb, 0xa4, 0xa3, 0xd4, 0xdc, 0x88, 0x6f, 0xfd, 0x76, 0x06, 0xcf, 0x36, + 0x1b, 0xc6, + ]; let key_exchange = SshPacketKeyExchange { cookie: &cookie, kex_algs: b"curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c", @@ -457,106 +467,114 @@ mod tests { #[test] fn test_parse_hassh() { - let client_key_exchange = [0x18 ,0x70 ,0xCB ,0xA4 ,0xA3 ,0xD4 ,0xDC ,0x88 ,0x6F - ,0xFD ,0x76 ,0x06 ,0xCF ,0x36 ,0x1B ,0xC6 ,0x00 ,0x00 ,0x01 ,0x0D ,0x63 ,0x75 ,0x72 ,0x76 - ,0x65 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 ,0x36 ,0x2C ,0x63 - ,0x75 ,0x72 ,0x76 ,0x65 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 - ,0x36 ,0x40 ,0x6C ,0x69 ,0x62 ,0x73 ,0x73 ,0x68 ,0x2E ,0x6F ,0x72 ,0x67 ,0x2C ,0x65 ,0x63 - ,0x64 ,0x68 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x32 ,0x35 - ,0x36 ,0x2C ,0x65 ,0x63 ,0x64 ,0x68 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 - ,0x74 ,0x70 ,0x33 ,0x38 ,0x34 ,0x2C ,0x65 ,0x63 ,0x64 ,0x68 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 - ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x35 ,0x32 ,0x31 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 - ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 - ,0x2D ,0x65 ,0x78 ,0x63 ,0x68 ,0x61 ,0x6E ,0x67 ,0x65 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 - ,0x36 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x36 ,0x2D ,0x73 ,0x68 ,0x61 ,0x35 ,0x31 - ,0x32 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x38 ,0x2D ,0x73 ,0x68 ,0x61 ,0x35 ,0x31 - ,0x32 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x34 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x35 - ,0x36 ,0x2C ,0x64 ,0x69 ,0x66 ,0x66 ,0x69 ,0x65 ,0x2D ,0x68 ,0x65 ,0x6C ,0x6C ,0x6D ,0x61 - ,0x6E ,0x2D ,0x67 ,0x72 ,0x6F ,0x75 ,0x70 ,0x31 ,0x34 ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x2C - ,0x65 ,0x78 ,0x74 ,0x2D ,0x69 ,0x6E ,0x66 ,0x6F ,0x2D ,0x63 ,0x00 ,0x00 ,0x01 ,0x66 ,0x65 - ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 - ,0x32 ,0x35 ,0x36 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 - ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x33 ,0x38 ,0x34 ,0x2D - ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 - ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 - ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x35 ,0x32 ,0x31 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 - ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F - ,0x6D ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 - ,0x73 ,0x74 ,0x70 ,0x32 ,0x35 ,0x36 ,0x2C ,0x65 ,0x63 ,0x64 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 - ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x33 ,0x38 ,0x34 ,0x2C ,0x65 ,0x63 ,0x64 - ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x6E ,0x69 ,0x73 ,0x74 ,0x70 ,0x35 ,0x32 - ,0x31 ,0x2C ,0x73 ,0x73 ,0x68 ,0x2D ,0x65 ,0x64 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2D ,0x63 - ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 - ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 - ,0x31 ,0x32 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 ,0x6F ,0x70 ,0x65 - ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 - ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 ,0x36 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 - ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x73 ,0x73 - ,0x68 ,0x2D ,0x72 ,0x73 ,0x61 ,0x2D ,0x63 ,0x65 ,0x72 ,0x74 ,0x2D ,0x76 ,0x30 ,0x31 ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x73 ,0x73 ,0x68 - ,0x2D ,0x65 ,0x64 ,0x32 ,0x35 ,0x35 ,0x31 ,0x39 ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 - ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 ,0x2C ,0x72 ,0x73 ,0x61 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 - ,0x2D ,0x32 ,0x35 ,0x36 ,0x2C ,0x73 ,0x73 ,0x68 ,0x2D ,0x72 ,0x73 ,0x61 ,0x00 ,0x00 ,0x00 - ,0x6C ,0x63 ,0x68 ,0x61 ,0x63 ,0x68 ,0x61 ,0x32 ,0x30 ,0x2D ,0x70 ,0x6F ,0x6C ,0x79 ,0x31 - ,0x33 ,0x30 ,0x35 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D - ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x32 ,0x38 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 - ,0x31 ,0x39 ,0x32 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x32 ,0x35 ,0x36 ,0x2D - ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x32 ,0x38 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x61 ,0x65 ,0x73 - ,0x32 ,0x35 ,0x36 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 - ,0x2E ,0x63 ,0x6F ,0x6D ,0x00 ,0x00 ,0x00 ,0x6C ,0x63 ,0x68 ,0x61 ,0x63 ,0x68 ,0x61 ,0x32 - ,0x30 ,0x2D ,0x70 ,0x6F ,0x6C ,0x79 ,0x31 ,0x33 ,0x30 ,0x35 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E - ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x32 ,0x38 ,0x2D - ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 ,0x39 ,0x32 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C - ,0x61 ,0x65 ,0x73 ,0x32 ,0x35 ,0x36 ,0x2D ,0x63 ,0x74 ,0x72 ,0x2C ,0x61 ,0x65 ,0x73 ,0x31 - ,0x32 ,0x38 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x61 ,0x65 ,0x73 ,0x32 ,0x35 ,0x36 ,0x2D ,0x67 ,0x63 ,0x6D ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x00 ,0x00 ,0x00 ,0xD5 - ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 - ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x31 - ,0x32 ,0x38 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 - ,0x35 ,0x36 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 - ,0x31 ,0x32 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E - ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x2D ,0x65 - ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C - ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 - ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x31 ,0x32 ,0x38 ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 ,0x36 ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D - ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 - ,0x68 ,0x61 ,0x31 ,0x00 ,0x00 ,0x00 ,0xD5 ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x2D - ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D - ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x31 ,0x32 ,0x38 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 ,0x36 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F - ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 - ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x2D ,0x65 ,0x74 ,0x6D ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 - ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 ,0x63 ,0x2D ,0x36 ,0x34 ,0x40 - ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x75 ,0x6D ,0x61 - ,0x63 ,0x2D ,0x31 ,0x32 ,0x38 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 ,0x68 ,0x2E ,0x63 - ,0x6F ,0x6D ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x32 ,0x35 - ,0x36 ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x32 ,0x2D ,0x35 ,0x31 ,0x32 - ,0x2C ,0x68 ,0x6D ,0x61 ,0x63 ,0x2D ,0x73 ,0x68 ,0x61 ,0x31 ,0x00 ,0x00 ,0x00 ,0x1A ,0x6E - ,0x6F ,0x6E ,0x65 ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 - ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x00 ,0x00 ,0x00 ,0x1A ,0x6E - ,0x6F ,0x6E ,0x65 ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x40 ,0x6F ,0x70 ,0x65 ,0x6E ,0x73 ,0x73 - ,0x68 ,0x2E ,0x63 ,0x6F ,0x6D ,0x2C ,0x7A ,0x6C ,0x69 ,0x62 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 - ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00]; - let mut hassh_string: Vec = vec!(); - let mut hassh: Vec = vec!(); - match ssh_parse_key_exchange(&client_key_exchange){ - Ok((_, key_exchange)) => { - key_exchange.generate_hassh(&mut hassh_string, &mut hassh, &true); + let client_key_exchange = [ + 0x18, 0x70, 0xCB, 0xA4, 0xA3, 0xD4, 0xDC, 0x88, 0x6F, 0xFD, 0x76, 0x06, 0xCF, 0x36, + 0x1B, 0xC6, 0x00, 0x00, 0x01, 0x0D, 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, + 0x31, 0x39, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2C, 0x63, 0x75, 0x72, 0x76, + 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x40, + 0x6C, 0x69, 0x62, 0x73, 0x73, 0x68, 0x2E, 0x6F, 0x72, 0x67, 0x2C, 0x65, 0x63, 0x64, + 0x68, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, + 0x36, 0x2C, 0x65, 0x63, 0x64, 0x68, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, + 0x73, 0x74, 0x70, 0x33, 0x38, 0x34, 0x2C, 0x65, 0x63, 0x64, 0x68, 0x2D, 0x73, 0x68, + 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, 0x31, 0x2C, 0x64, 0x69, + 0x66, 0x66, 0x69, 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, + 0x72, 0x6F, 0x75, 0x70, 0x2D, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6E, 0x67, 0x65, 0x2D, + 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2C, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2D, + 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, 0x72, 0x6F, 0x75, 0x70, 0x31, + 0x36, 0x2D, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2C, 0x64, 0x69, 0x66, 0x66, 0x69, + 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, 0x72, 0x6F, 0x75, + 0x70, 0x31, 0x38, 0x2D, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2C, 0x64, 0x69, 0x66, + 0x66, 0x69, 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, 0x67, 0x72, + 0x6F, 0x75, 0x70, 0x31, 0x34, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2C, 0x64, + 0x69, 0x66, 0x66, 0x69, 0x65, 0x2D, 0x68, 0x65, 0x6C, 0x6C, 0x6D, 0x61, 0x6E, 0x2D, + 0x67, 0x72, 0x6F, 0x75, 0x70, 0x31, 0x34, 0x2D, 0x73, 0x68, 0x61, 0x31, 0x2C, 0x65, + 0x78, 0x74, 0x2D, 0x69, 0x6E, 0x66, 0x6F, 0x2D, 0x63, 0x00, 0x00, 0x01, 0x66, 0x65, + 0x63, 0x64, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, + 0x70, 0x32, 0x35, 0x36, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, + 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x65, 0x63, + 0x64, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, + 0x33, 0x38, 0x34, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, + 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x65, 0x63, 0x64, + 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x35, + 0x32, 0x31, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, + 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x65, 0x63, 0x64, 0x73, + 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, + 0x36, 0x2C, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, + 0x69, 0x73, 0x74, 0x70, 0x33, 0x38, 0x34, 0x2C, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2D, + 0x73, 0x68, 0x61, 0x32, 0x2D, 0x6E, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, 0x31, 0x2C, + 0x73, 0x73, 0x68, 0x2D, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2D, 0x63, 0x65, + 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x72, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, + 0x35, 0x31, 0x32, 0x2D, 0x63, 0x65, 0x72, 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, + 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x72, 0x73, 0x61, + 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2D, 0x63, 0x65, 0x72, 0x74, + 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, + 0x6F, 0x6D, 0x2C, 0x73, 0x73, 0x68, 0x2D, 0x72, 0x73, 0x61, 0x2D, 0x63, 0x65, 0x72, + 0x74, 0x2D, 0x76, 0x30, 0x31, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, + 0x63, 0x6F, 0x6D, 0x2C, 0x73, 0x73, 0x68, 0x2D, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, + 0x39, 0x2C, 0x72, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x35, 0x31, 0x32, + 0x2C, 0x72, 0x73, 0x61, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2C, + 0x73, 0x73, 0x68, 0x2D, 0x72, 0x73, 0x61, 0x00, 0x00, 0x00, 0x6C, 0x63, 0x68, 0x61, + 0x63, 0x68, 0x61, 0x32, 0x30, 0x2D, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, + 0x39, 0x32, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, + 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x67, 0x63, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, 0x67, 0x63, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, + 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x00, 0x00, 0x6C, 0x63, 0x68, 0x61, + 0x63, 0x68, 0x61, 0x32, 0x30, 0x2D, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, + 0x39, 0x32, 0x2D, 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, + 0x63, 0x74, 0x72, 0x2C, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2D, 0x67, 0x63, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x61, + 0x65, 0x73, 0x32, 0x35, 0x36, 0x2D, 0x67, 0x63, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, + 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x00, 0x00, 0xD5, 0x75, 0x6D, 0x61, + 0x63, 0x2D, 0x36, 0x34, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, + 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x31, 0x32, + 0x38, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, + 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, + 0x32, 0x35, 0x36, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, + 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, + 0x32, 0x2D, 0x35, 0x31, 0x32, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, + 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, + 0x68, 0x61, 0x31, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, + 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x36, 0x34, 0x40, + 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, + 0x61, 0x63, 0x2D, 0x31, 0x32, 0x38, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, + 0x2D, 0x32, 0x35, 0x36, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, + 0x2D, 0x35, 0x31, 0x32, 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x31, + 0x00, 0x00, 0x00, 0xD5, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x36, 0x34, 0x2D, 0x65, 0x74, + 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, + 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x31, 0x32, 0x38, 0x2D, 0x65, 0x74, 0x6D, 0x40, 0x6F, + 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, 0x61, + 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2D, 0x65, 0x74, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, + 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x35, 0x31, 0x32, 0x2D, 0x65, + 0x74, 0x6D, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, + 0x2C, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x31, 0x2D, 0x65, 0x74, 0x6D, + 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, + 0x6D, 0x61, 0x63, 0x2D, 0x36, 0x34, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x75, 0x6D, 0x61, 0x63, 0x2D, 0x31, 0x32, 0x38, 0x40, + 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x68, 0x6D, + 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x32, 0x35, 0x36, 0x2C, 0x68, 0x6D, + 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x32, 0x2D, 0x35, 0x31, 0x32, 0x2C, 0x68, 0x6D, + 0x61, 0x63, 0x2D, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0x1A, 0x6E, 0x6F, 0x6E, + 0x65, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, 0x73, 0x68, + 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x00, 0x00, 0x00, 0x1A, 0x6E, + 0x6F, 0x6E, 0x65, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x40, 0x6F, 0x70, 0x65, 0x6E, 0x73, + 0x73, 0x68, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x7A, 0x6C, 0x69, 0x62, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ]; + let mut hassh_string: Vec = vec![]; + let mut hassh: Vec = vec![]; + match ssh_parse_key_exchange(&client_key_exchange) { + Ok((_, key_exchange)) => { + key_exchange.generate_hassh(&mut hassh_string, &mut hassh, &true); } - Err(_) => { } + Err(_) => {} } assert_eq!(hassh_string, "curve25519-sha256,curve25519-sha256@libssh.org,\ @@ -567,167 +585,194 @@ mod tests { umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,\ hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,\ hmac-sha2-256,hmac-sha2-512,hmac-sha1;none,zlib@openssh.com,zlib".as_bytes().to_vec()); - - assert_eq!(hassh, "ec7378c1a92f5a8dde7e8b7a1ddf33d1".as_bytes().to_vec()); + + assert_eq!( + hassh, + "ec7378c1a92f5a8dde7e8b7a1ddf33d1".as_bytes().to_vec() + ); } #[test] fn test_parse_hassh_server() { - let server_key_exchange = [0x7d, 0x76, 0x4f, 0x78, 0x81, 0x9e, 0x10, 0xfa, 0x23, 0x72, - 0xb5, 0x15, 0x56, 0xba, 0xf9, 0x46, 0x00, 0x00, 0x01, 0x02, 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, - 0x35, 0x35, 0x31, 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x63, 0x75, 0x72, 0x76, - 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x40, 0x6c, 0x69, - 0x62, 0x73, 0x73, 0x68, 0x2e, 0x6f, 0x72, 0x67, 0x2c, 0x65, 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, - 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, 0x36, 0x2c, 0x65, 0x63, 0x64, 0x68, - 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x33, 0x38, 0x34, 0x2c, 0x65, - 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, - 0x31, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, - 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2d, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, - 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, - 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x36, 0x2d, 0x73, 0x68, - 0x61, 0x35, 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, - 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x38, 0x2d, 0x73, 0x68, 0x61, 0x35, - 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, - 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, - 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0x41, - 0x73, 0x73, 0x68, 0x2d, 0x72, 0x73, 0x61, 0x2c, 0x72, 0x73, 0x61, 0x2d, 0x73, 0x68, 0x61, 0x32, - 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x72, 0x73, 0x61, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, - 0x36, 0x2c, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, - 0x74, 0x70, 0x32, 0x35, 0x36, 0x2c, 0x73, 0x73, 0x68, 0x2d, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, - 0x39, 0x00, 0x00, 0x00, 0x6c, 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, - 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, - 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, - 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, - 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, - 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, - 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, - 0x6d, 0x00, 0x00, 0x00, 0x6c, 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, - 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, - 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, - 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, - 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, - 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, - 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, - 0x6d, 0x00, 0x00, 0x00, 0xd5, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x2d, 0x65, 0x74, 0x6d, - 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, - 0x63, 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, - 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, - 0x32, 0x35, 0x36, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, - 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, - 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, - 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x2d, 0x65, 0x74, 0x6d, 0x40, - 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, - 0x2d, 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, - 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, - 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, - 0x35, 0x36, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, - 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0xd5, 0x75, 0x6d, - 0x61, 0x63, 0x2d, 0x36, 0x34, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, - 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, - 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, - 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2d, 0x65, 0x74, 0x6d, - 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, - 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, - 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, - 0x73, 0x68, 0x61, 0x31, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, - 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, - 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, - 0x38, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, - 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2c, 0x68, 0x6d, 0x61, 0x63, - 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, - 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0x15, 0x6e, 0x6f, 0x6e, 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, - 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x15, - 0x6e, 0x6f, 0x6e, 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, - 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; - let mut hassh_server_string: Vec = vec!(); - let mut hassh_server: Vec = vec!(); - match ssh_parse_key_exchange(&server_key_exchange){ - Ok((_, key_exchange)) => { + let server_key_exchange = [ + 0x7d, 0x76, 0x4f, 0x78, 0x81, 0x9e, 0x10, 0xfa, 0x23, 0x72, 0xb5, 0x15, 0x56, 0xba, + 0xf9, 0x46, 0x00, 0x00, 0x01, 0x02, 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, + 0x31, 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x63, 0x75, 0x72, 0x76, + 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x40, + 0x6c, 0x69, 0x62, 0x73, 0x73, 0x68, 0x2e, 0x6f, 0x72, 0x67, 0x2c, 0x65, 0x63, 0x64, + 0x68, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, + 0x36, 0x2c, 0x65, 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, + 0x73, 0x74, 0x70, 0x33, 0x38, 0x34, 0x2c, 0x65, 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, + 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, 0x31, 0x2c, 0x64, 0x69, + 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x2d, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, + 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, + 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, + 0x36, 0x2d, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, + 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x31, 0x38, 0x2d, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, + 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x64, + 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, + 0x00, 0x41, 0x73, 0x73, 0x68, 0x2d, 0x72, 0x73, 0x61, 0x2c, 0x72, 0x73, 0x61, 0x2d, + 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x72, 0x73, 0x61, 0x2d, 0x73, + 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2c, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2d, + 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, 0x36, 0x2c, + 0x73, 0x73, 0x68, 0x2d, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x00, 0x00, 0x00, + 0x6c, 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, 0x6c, 0x79, + 0x31, 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, + 0x61, 0x65, 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, + 0x32, 0x35, 0x36, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, + 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, + 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, + 0x6c, 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, 0x6c, 0x79, + 0x31, 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, + 0x61, 0x65, 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, + 0x32, 0x35, 0x36, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, + 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, + 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, + 0xd5, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, + 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, + 0x63, 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, + 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, + 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, + 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, + 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, + 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, + 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, + 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, + 0x2d, 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x40, 0x6f, 0x70, 0x65, + 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, + 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, + 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, + 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0xd5, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, + 0x34, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, + 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, + 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, + 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, + 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, + 0x31, 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, + 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, + 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, + 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, + 0x31, 0x32, 0x38, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, + 0x36, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, + 0x32, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, + 0x15, 0x6e, 0x6f, 0x6e, 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, 0x40, 0x6f, 0x70, 0x65, + 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x15, 0x6e, 0x6f, + 0x6e, 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, + 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ]; + let mut hassh_server_string: Vec = vec![]; + let mut hassh_server: Vec = vec![]; + match ssh_parse_key_exchange(&server_key_exchange) { + Ok((_, key_exchange)) => { key_exchange.generate_hassh(&mut hassh_server_string, &mut hassh_server, &true); } - Err(_) => { } + Err(_) => {} } - assert_eq!(hassh_server, "b12d2871a1189eff20364cf5333619ee".as_bytes().to_vec()); + assert_eq!( + hassh_server, + "b12d2871a1189eff20364cf5333619ee".as_bytes().to_vec() + ); } - + #[test] fn test_parse_hassh_server_malicious() { - let server_key_exchange = [0x7d, 0x76, 0x4f, 0x78, 0x81, 0x9e, 0x10, 0xfa, 0x23, 0x72, - 0xb5, 0x15, 0x56, 0xba, 0xf9, 0x46, 0x00, 0x00, 0x01, 0x02, 0x75, 0x72, 0x76, 0x65, 0x32, - 0x35, 0x35, 0x31, 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x63, 0x75, 0x72, 0x76, - 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x40, 0x6c, 0x69, - 0x62, 0x73, 0x73, 0x68, 0x2e, 0x6f, 0x72, 0x67, 0x2c, 0x65, 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, - 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, 0x36, 0x2c, 0x65, 0x63, 0x64, 0x68, - 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x33, 0x38, 0x34, 0x2c, 0x65, - 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, - 0x31, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, - 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2d, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, - 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, - 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x36, 0x2d, 0x73, 0x68, - 0x61, 0x35, 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, - 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x38, 0x2d, 0x73, 0x68, 0x61, 0x35, - 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, - 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, - 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0x41, - 0x73, 0x73, 0x68, 0x2d, 0x72, 0x73, 0x61, 0x2c, 0x72, 0x73, 0x61, 0x2d, 0x73, 0x68, 0x61, 0x32, - 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x72, 0x73, 0x61, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, - 0x36, 0x2c, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, - 0x74, 0x70, 0x32, 0x35, 0x36, 0x2c, 0x73, 0x73, 0x68, 0x2d, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, - 0x39, 0x00, 0x00, 0x00, 0x6c, 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, - 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, - 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, - 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, - 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, - 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, - 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, - 0x6d, 0x00, 0x00, 0x00, 0x6c, 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, - 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, - 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, - 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, - 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, - 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, - 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, - 0x6d, 0x00, 0x00, 0x00, 0xd5, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x2d, 0x65, 0x74, 0x6d, - 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, - 0x63, 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, - 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, - 0x32, 0x35, 0x36, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, - 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, - 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, - 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x2d, 0x65, 0x74, 0x6d, 0x40, - 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, - 0x2d, 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, - 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, - 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, - 0x35, 0x36, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, - 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0xd5, 0x75, 0x6d, - 0x61, 0x63, 0x2d, 0x36, 0x34, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, - 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, - 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, - 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2d, 0x65, 0x74, 0x6d, - 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, - 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, - 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, - 0x73, 0x68, 0x61, 0x31, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, - 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, - 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, - 0x38, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, - 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2c, 0x68, 0x6d, 0x61, 0x63, - 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, - 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0x15, 0x6e, 0x6f, 0x6e, 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, - 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x15, - 0x6e, 0x6f, 0x6e, 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, - 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + let server_key_exchange = [ + 0x7d, 0x76, 0x4f, 0x78, 0x81, 0x9e, 0x10, 0xfa, 0x23, 0x72, 0xb5, 0x15, 0x56, 0xba, + 0xf9, 0x46, 0x00, 0x00, 0x01, 0x02, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, 0x31, + 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x63, 0x75, 0x72, 0x76, 0x65, + 0x32, 0x35, 0x35, 0x31, 0x39, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x40, 0x6c, + 0x69, 0x62, 0x73, 0x73, 0x68, 0x2e, 0x6f, 0x72, 0x67, 0x2c, 0x65, 0x63, 0x64, 0x68, + 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, 0x36, + 0x2c, 0x65, 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, + 0x74, 0x70, 0x33, 0x38, 0x34, 0x2c, 0x65, 0x63, 0x64, 0x68, 0x2d, 0x73, 0x68, 0x61, + 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x35, 0x32, 0x31, 0x2c, 0x64, 0x69, 0x66, + 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x2d, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, 0x73, + 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, + 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x36, + 0x2d, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, 0x66, 0x69, 0x65, + 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x31, 0x38, 0x2d, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x2c, 0x64, 0x69, 0x66, 0x66, + 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x2c, 0x64, 0x69, + 0x66, 0x66, 0x69, 0x65, 0x2d, 0x68, 0x65, 0x6c, 0x6c, 0x6d, 0x61, 0x6e, 0x2d, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x31, 0x34, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, + 0x41, 0x73, 0x73, 0x68, 0x2d, 0x72, 0x73, 0x61, 0x2c, 0x72, 0x73, 0x61, 0x2d, 0x73, + 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x72, 0x73, 0x61, 0x2d, 0x73, 0x68, + 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2c, 0x65, 0x63, 0x64, 0x73, 0x61, 0x2d, 0x73, + 0x68, 0x61, 0x32, 0x2d, 0x6e, 0x69, 0x73, 0x74, 0x70, 0x32, 0x35, 0x36, 0x2c, 0x73, + 0x73, 0x68, 0x2d, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x00, 0x00, 0x00, 0x6c, + 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, 0x6c, 0x79, 0x31, + 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, + 0x65, 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x32, + 0x35, 0x36, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, + 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, + 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x6c, + 0x63, 0x68, 0x61, 0x63, 0x68, 0x61, 0x32, 0x30, 0x2d, 0x70, 0x6f, 0x6c, 0x79, 0x31, + 0x33, 0x30, 0x35, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, + 0x65, 0x73, 0x31, 0x39, 0x32, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x32, + 0x35, 0x36, 0x2d, 0x63, 0x74, 0x72, 0x2c, 0x61, 0x65, 0x73, 0x31, 0x32, 0x38, 0x2d, + 0x67, 0x63, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x61, 0x65, 0x73, 0x32, 0x35, 0x36, 0x2d, 0x67, 0x63, 0x6d, 0x40, 0x6f, + 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0xd5, + 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, + 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, + 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, + 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, + 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, + 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, + 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, + 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, + 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, + 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, + 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, + 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x40, 0x6f, 0x70, 0x65, 0x6e, + 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, + 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, + 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, + 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0xd5, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, + 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, 0x32, 0x38, 0x2d, 0x65, 0x74, + 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, + 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, 0x2d, + 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, + 0x32, 0x2d, 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, + 0x63, 0x6f, 0x6d, 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x2d, + 0x65, 0x74, 0x6d, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, + 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x36, 0x34, 0x40, 0x6f, 0x70, 0x65, 0x6e, + 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x75, 0x6d, 0x61, 0x63, 0x2d, 0x31, + 0x32, 0x38, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, + 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x32, 0x35, 0x36, + 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x32, 0x2d, 0x35, 0x31, 0x32, + 0x2c, 0x68, 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x68, 0x61, 0x31, 0x00, 0x00, 0x00, 0x15, + 0x6e, 0x6f, 0x6e, 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, 0x40, 0x6f, 0x70, 0x65, 0x6e, + 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x15, 0x6e, 0x6f, 0x6e, + 0x65, 0x2c, 0x7a, 0x6c, 0x69, 0x62, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, + 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ]; if let Err(e) = ssh_parse_key_exchange(&server_key_exchange) { assert_eq!(e, Err::Incomplete(Needed::new(15964))); - } - else { + } else { panic!("ssh_parse_key_exchange() parsed malicious key_exchange"); } -} + } } diff --git a/rust/src/ssh/ssh.rs b/rust/src/ssh/ssh.rs index 6280e0b6ace9..306a91f9cc92 100644 --- a/rust/src/ssh/ssh.rs +++ b/rust/src/ssh/ssh.rs @@ -154,8 +154,14 @@ impl SSHState { parser::MessageCode::Kexinit if hassh_is_enabled() => { //let endkex = SSH_RECORD_HEADER_LEN + head.pkt_len - 2; let endkex = input.len() - rem.len(); - if let Ok((_, key_exchange)) = parser::ssh_parse_key_exchange(&input[SSH_RECORD_HEADER_LEN..endkex]) { - key_exchange.generate_hassh(&mut hdr.hassh_string, &mut hdr.hassh, &resp); + if let Ok((_, key_exchange)) = parser::ssh_parse_key_exchange( + &input[SSH_RECORD_HEADER_LEN..endkex], + ) { + key_exchange.generate_hassh( + &mut hdr.hassh_string, + &mut hdr.hassh, + &resp, + ); } } parser::MessageCode::NewKeys => { @@ -165,15 +171,15 @@ impl SSHState { AppLayerParserStateSetFlag( pstate, APP_LAYER_PARSER_NO_INSPECTION - | APP_LAYER_PARSER_NO_REASSEMBLY - | APP_LAYER_PARSER_BYPASS_READY, + | APP_LAYER_PARSER_NO_REASSEMBLY + | APP_LAYER_PARSER_BYPASS_READY, ); } } } _ => {} } - + input = rem; //header and complete data (not returned) } @@ -184,7 +190,7 @@ impl SSHState { let remlen = rem.len() as u32; hdr.record_left = head.pkt_len - 2 - remlen; //header with rem as incomplete data - match head.msg_code { + match head.msg_code { parser::MessageCode::NewKeys => { hdr.flags = SSHConnectionState::SshStateFinished; } @@ -196,10 +202,9 @@ impl SSHState { hdr.record_left_msg = parser::MessageCode::Kexinit; return AppLayerResult::incomplete( (il - rem.len()) as u32, - head.pkt_len - 2 + head.pkt_len - 2, ); - } - else { + } else { SCLogDebug!("SSH buffer is bigger than maximum reassembled packet size"); self.set_event(SSHEvent::LongKexRecord); } @@ -332,27 +337,28 @@ export_tx_data_get!(rs_ssh_get_tx_data, SSHTransaction); export_state_data_get!(rs_ssh_get_state_data, SSHState); #[no_mangle] -pub extern "C" fn rs_ssh_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_ssh_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = SSHState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_state_free(state: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_ssh_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(Box::from_raw(state as *mut SSHState)); } #[no_mangle] -pub extern "C" fn rs_ssh_state_tx_free(_state: *mut std::os::raw::c_void, _tx_id: u64) { +pub extern fn rs_ssh_state_tx_free(_state: *mut std::os::raw::c_void, _tx_id: u64) { //do nothing } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_parse_request( +pub unsafe extern fn rs_ssh_parse_request( _flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = &mut cast_pointer!(state, SSHState); let buf = stream_slice.as_slice(); @@ -365,10 +371,9 @@ pub unsafe extern "C" fn rs_ssh_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_parse_response( +pub unsafe extern fn rs_ssh_parse_response( _flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = &mut cast_pointer!(state, SSHState); let buf = stream_slice.as_slice(); @@ -381,7 +386,7 @@ pub unsafe extern "C" fn rs_ssh_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_state_get_tx( +pub unsafe extern fn rs_ssh_state_get_tx( state: *mut std::os::raw::c_void, _tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, SSHState); @@ -389,12 +394,12 @@ pub unsafe extern "C" fn rs_ssh_state_get_tx( } #[no_mangle] -pub extern "C" fn rs_ssh_state_get_tx_count(_state: *mut std::os::raw::c_void) -> u64 { +pub extern fn rs_ssh_state_get_tx_count(_state: *mut std::os::raw::c_void) -> u64 { return 1; } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_tx_get_flags( +pub unsafe extern fn rs_ssh_tx_get_flags( tx: *mut std::os::raw::c_void, direction: u8, ) -> SSHConnectionState { let tx = cast_pointer!(tx, SSHTransaction); @@ -406,7 +411,7 @@ pub unsafe extern "C" fn rs_ssh_tx_get_flags( } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_tx_get_alstate_progress( +pub unsafe extern fn rs_ssh_tx_get_alstate_progress( tx: *mut std::os::raw::c_void, direction: u8, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, SSHTransaction); @@ -432,7 +437,7 @@ pub unsafe extern "C" fn rs_ssh_tx_get_alstate_progress( const PARSER_NAME: &[u8] = b"ssh\0"; #[no_mangle] -pub unsafe extern "C" fn rs_ssh_register_parser() { +pub unsafe extern fn rs_ssh_register_parser() { let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, default_port: std::ptr::null(), @@ -482,27 +487,28 @@ pub unsafe extern "C" fn rs_ssh_register_parser() { } #[no_mangle] -pub extern "C" fn rs_ssh_enable_hassh() { +pub extern fn rs_ssh_enable_hassh() { HASSH_ENABLED.store(true, Ordering::Relaxed) } #[no_mangle] -pub extern "C" fn rs_ssh_hassh_is_enabled() -> bool { +pub extern fn rs_ssh_hassh_is_enabled() -> bool { hassh_is_enabled() } #[no_mangle] -pub unsafe extern "C" fn rs_ssh_tx_get_log_condition( tx: *mut std::os::raw::c_void) -> bool { +pub unsafe extern fn rs_ssh_tx_get_log_condition(tx: *mut std::os::raw::c_void) -> bool { let tx = cast_pointer!(tx, SSHTransaction); - + if rs_ssh_hassh_is_enabled() { - if tx.cli_hdr.flags == SSHConnectionState::SshStateFinished && - tx.srv_hdr.flags == SSHConnectionState::SshStateFinished { - return true; + if tx.cli_hdr.flags == SSHConnectionState::SshStateFinished + && tx.srv_hdr.flags == SSHConnectionState::SshStateFinished + { + return true; } - } - else if tx.cli_hdr.flags == SSHConnectionState::SshStateBannerDone && - tx.srv_hdr.flags == SSHConnectionState::SshStateBannerDone { + } else if tx.cli_hdr.flags == SSHConnectionState::SshStateBannerDone + && tx.srv_hdr.flags == SSHConnectionState::SshStateBannerDone + { return true; } return false; diff --git a/rust/src/telnet/mod.rs b/rust/src/telnet/mod.rs index 38685c795443..6af7a8d6c387 100644 --- a/rust/src/telnet/mod.rs +++ b/rust/src/telnet/mod.rs @@ -17,5 +17,5 @@ //! Telnet application layer and parser module. -pub mod telnet; mod parser; +pub mod telnet; diff --git a/rust/src/telnet/parser.rs b/rust/src/telnet/parser.rs index e2dbfa4a6eea..cdacdd49aa65 100644 --- a/rust/src/telnet/parser.rs +++ b/rust/src/telnet/parser.rs @@ -16,12 +16,12 @@ */ use crate::common::nom7::take_until_and_consume; -use nom7::combinator::peek; use nom7::bytes::complete::take; -use nom7::{IResult}; -use nom7::number::streaming::le_u8; use nom7::bytes::streaming::tag; -use nom7::bytes::streaming::{take_until}; +use nom7::bytes::streaming::take_until; +use nom7::combinator::peek; +use nom7::number::streaming::le_u8; +use nom7::IResult; pub fn peek_message_is_ctl(i: &[u8]) -> IResult<&[u8], bool> { let (i, v) = peek(le_u8)(i)?; @@ -33,11 +33,11 @@ pub enum TelnetMessageType<'a> { Data(&'a [u8]), } -pub fn parse_ctl_suboption<'a>(i: &'a[u8], full: &'a[u8]) -> IResult<&'a[u8], &'a[u8]> { +pub fn parse_ctl_suboption<'a>(i: &'a [u8], full: &'a [u8]) -> IResult<&'a [u8], &'a [u8]> { let (i, _sc) = le_u8(i)?; let tag: &[u8] = b"\xff\xf0"; let (i, x) = take_until(tag)(i)?; - let o = &full[..(x.len()+3)]; + let o = &full[..(x.len() + 3)]; Ok((i, o)) } diff --git a/rust/src/telnet/telnet.rs b/rust/src/telnet/telnet.rs index f1e7eec50281..99e355fcaac6 100644 --- a/rust/src/telnet/telnet.rs +++ b/rust/src/telnet/telnet.rs @@ -15,13 +15,13 @@ * 02110-1301, USA. */ -use std; -use crate::core::{ALPROTO_UNKNOWN, AppProto, Flow, IPPROTO_TCP}; +use super::parser; use crate::applayer::{self, *}; +use crate::core::{AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_TCP}; use crate::frames::*; -use std::ffi::CString; use nom7::IResult; -use super::parser; +use std; +use std::ffi::CString; static mut ALPROTO_TELNET: AppProto = ALPROTO_UNKNOWN; @@ -184,7 +184,7 @@ impl TelnetState { -1_i64, TelnetFrameType::Data as u8, ) - // app-layer-frame-documentation tag end: parse_request + // app-layer-frame-documentation tag end: parse_request }; self.request_specific_frame = f; } @@ -246,7 +246,9 @@ impl TelnetState { return AppLayerResult::ok(); } - fn parse_response(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8]) -> AppLayerResult { + fn parse_response( + &mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8], + ) -> AppLayerResult { // We're not interested in empty responses. if input.is_empty() { return AppLayerResult::ok(); @@ -266,14 +268,32 @@ impl TelnetState { let mut start = input; while !start.is_empty() { if self.response_frame.is_none() { - self.response_frame = Frame::new(flow, stream_slice, start, -1_i64, TelnetFrameType::Pdu as u8); + self.response_frame = Frame::new( + flow, + stream_slice, + start, + -1_i64, + TelnetFrameType::Pdu as u8, + ); } if self.response_specific_frame.is_none() { if let Ok((_, is_ctl)) = parser::peek_message_is_ctl(start) { self.response_specific_frame = if is_ctl { - Frame::new(flow, stream_slice, start, -1_i64, TelnetFrameType::Ctl as u8) + Frame::new( + flow, + stream_slice, + start, + -1_i64, + TelnetFrameType::Ctl as u8, + ) } else { - Frame::new(flow, stream_slice, start, -1_i64, TelnetFrameType::Data as u8) + Frame::new( + flow, + stream_slice, + start, + -1_i64, + TelnetFrameType::Data as u8, + ) }; } } @@ -300,37 +320,34 @@ impl TelnetState { if let parser::TelnetMessageType::Data(d) = response { match self.state { - TelnetProtocolState::Idle | - TelnetProtocolState::AuthFail => { + TelnetProtocolState::Idle | TelnetProtocolState::AuthFail => { self.state = TelnetProtocolState::LoginSent; - }, + } TelnetProtocolState::LoginRecv => { self.state = TelnetProtocolState::PasswdSent; - }, + } TelnetProtocolState::PasswdRecv => { if let Ok(message) = std::str::from_utf8(d) { match message { "Login incorrect" => { SCLogDebug!("LOGIN FAILED"); self.state = TelnetProtocolState::AuthFail; - }, - "" => { - - }, + } + "" => {} &_ => { SCLogDebug!("LOGIN OK"); self.state = TelnetProtocolState::AuthOk; - }, + } } } - }, + } TelnetProtocolState::AuthOk => { let _message = std::str::from_utf8(d); if let Ok(_message) = _message { SCLogDebug!("<= {}", _message); } - }, - _ => {}, + } + _ => {} } } else if let parser::TelnetMessageType::Control(_c) = response { SCLogDebug!("response {:?}", _c); @@ -374,12 +391,8 @@ fn probe(input: &[u8]) -> IResult<&[u8], ()> { /// C entry point for a probing parser. #[no_mangle] -pub unsafe extern "C" fn rs_telnet_probing_parser( - _flow: *const Flow, - _direction: u8, - input: *const u8, - input_len: u32, - _rdir: *mut u8 +pub unsafe extern fn rs_telnet_probing_parser( + _flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8, ) -> AppProto { // Need at least 2 bytes. if input_len > 1 && !input.is_null() { @@ -393,33 +406,29 @@ pub unsafe extern "C" fn rs_telnet_probing_parser( } #[no_mangle] -pub extern "C" fn rs_telnet_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void { +pub extern fn rs_telnet_state_new( + _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto, +) -> *mut std::os::raw::c_void { let state = TelnetState::new(); let boxed = Box::new(state); return Box::into_raw(boxed) as *mut std::os::raw::c_void; } #[no_mangle] -pub unsafe extern "C" fn rs_telnet_state_free(state: *mut std::os::raw::c_void) { +pub unsafe extern fn rs_telnet_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(Box::from_raw(state as *mut TelnetState)); } #[no_mangle] -pub unsafe extern "C" fn rs_telnet_state_tx_free( - state: *mut std::os::raw::c_void, - tx_id: u64, -) { +pub unsafe extern fn rs_telnet_state_tx_free(state: *mut std::os::raw::c_void, tx_id: u64) { let state = cast_pointer!(state, TelnetState); state.free_tx(tx_id); } #[no_mangle] -pub unsafe extern "C" fn rs_telnet_parse_request( - flow: *const Flow, - state: *mut std::os::raw::c_void, - pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void +pub unsafe extern fn rs_telnet_parse_request( + flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let eof = AppLayerParserStateIssetFlag(pstate, APP_LAYER_PARSER_EOF_TS) > 0; @@ -442,12 +451,9 @@ pub unsafe extern "C" fn rs_telnet_parse_request( } #[no_mangle] -pub unsafe extern "C" fn rs_telnet_parse_response( - flow: *const Flow, - state: *mut std::os::raw::c_void, - pstate: *mut std::os::raw::c_void, - stream_slice: StreamSlice, - _data: *const std::os::raw::c_void +pub unsafe extern fn rs_telnet_parse_response( + flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void, + stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let _eof = AppLayerParserStateIssetFlag(pstate, APP_LAYER_PARSER_EOF_TC) > 0; let state = cast_pointer!(state, TelnetState); @@ -464,9 +470,8 @@ pub unsafe extern "C" fn rs_telnet_parse_response( } #[no_mangle] -pub unsafe extern "C" fn rs_telnet_state_get_tx( - state: *mut std::os::raw::c_void, - tx_id: u64, +pub unsafe extern fn rs_telnet_state_get_tx( + state: *mut std::os::raw::c_void, tx_id: u64, ) -> *mut std::os::raw::c_void { let state = cast_pointer!(state, TelnetState); match state.get_tx(tx_id) { @@ -480,17 +485,14 @@ pub unsafe extern "C" fn rs_telnet_state_get_tx( } #[no_mangle] -pub unsafe extern "C" fn rs_telnet_state_get_tx_count( - state: *mut std::os::raw::c_void, -) -> u64 { +pub unsafe extern fn rs_telnet_state_get_tx_count(state: *mut std::os::raw::c_void) -> u64 { let state = cast_pointer!(state, TelnetState); return state.tx_id; } #[no_mangle] -pub unsafe extern "C" fn rs_telnet_tx_get_alstate_progress( - tx: *mut std::os::raw::c_void, - _direction: u8, +pub unsafe extern fn rs_telnet_tx_get_alstate_progress( + tx: *mut std::os::raw::c_void, _direction: u8, ) -> std::os::raw::c_int { let _tx = cast_pointer!(tx, TelnetTransaction); // TODO @@ -504,7 +506,7 @@ export_state_data_get!(rs_telnet_get_state_data, TelnetState); const PARSER_NAME: &[u8] = b"telnet\0"; #[no_mangle] -pub unsafe extern "C" fn rs_telnet_register_parser() { +pub unsafe extern fn rs_telnet_register_parser() { let default_port = CString::new("[23]").unwrap(); let parser = RustParser { name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char, @@ -525,7 +527,7 @@ pub unsafe extern "C" fn rs_telnet_register_parser() { tx_comp_st_tc: 1, tx_get_progress: rs_telnet_tx_get_alstate_progress, get_eventinfo: Some(TelnetEvent::get_event_info), - get_eventinfo_byid : Some(TelnetEvent::get_event_info_by_id), + get_eventinfo_byid: Some(TelnetEvent::get_event_info_by_id), localstorage_new: None, localstorage_free: None, get_tx_files: None, @@ -537,23 +539,14 @@ pub unsafe extern "C" fn rs_telnet_register_parser() { truncate: None, get_frame_id_by_name: Some(TelnetFrameType::ffi_id_from_name), get_frame_name_by_id: Some(TelnetFrameType::ffi_name_from_id), - }; let ip_proto_str = CString::new("tcp").unwrap(); - if AppLayerProtoDetectConfProtoDetectionEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let alproto = AppLayerRegisterProtocolDetection(&parser, 1); ALPROTO_TELNET = alproto; - if AppLayerParserConfParserEnabled( - ip_proto_str.as_ptr(), - parser.name, - ) != 0 - { + if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { let _ = AppLayerRegisterParser(&parser, alproto); } SCLogDebug!("Rust telnet parser registered."); diff --git a/rust/src/tftp/log.rs b/rust/src/tftp/log.rs index f6e63531a07e..30a840c4e1d9 100644 --- a/rust/src/tftp/log.rs +++ b/rust/src/tftp/log.rs @@ -20,15 +20,12 @@ use crate::jsonbuilder::{JsonBuilder, JsonError}; use crate::tftp::tftp::TFTPTransaction; -fn tftp_log_request(tx: &mut TFTPTransaction, - jb: &mut JsonBuilder) - -> Result<(), JsonError> -{ +fn tftp_log_request(tx: &mut TFTPTransaction, jb: &mut JsonBuilder) -> Result<(), JsonError> { jb.open_object("tftp")?; match tx.opcode { 1 => jb.set_string("packet", "read")?, 2 => jb.set_string("packet", "write")?, - _ => jb.set_string("packet", "error")? + _ => jb.set_string("packet", "error")?, }; jb.set_string("file", tx.filename.as_str())?; jb.set_string("mode", tx.mode.as_str())?; @@ -37,9 +34,6 @@ fn tftp_log_request(tx: &mut TFTPTransaction, } #[no_mangle] -pub extern "C" fn rs_tftp_log_json_request(tx: &mut TFTPTransaction, - jb: &mut JsonBuilder) - -> bool -{ +pub extern fn rs_tftp_log_json_request(tx: &mut TFTPTransaction, jb: &mut JsonBuilder) -> bool { tftp_log_request(tx, jb).is_ok() } diff --git a/rust/src/tftp/mod.rs b/rust/src/tftp/mod.rs index 6ae29ac90143..cd7c5ec45aab 100644 --- a/rust/src/tftp/mod.rs +++ b/rust/src/tftp/mod.rs @@ -19,5 +19,5 @@ // written by Clément Galland -pub mod tftp; pub mod log; +pub mod tftp; diff --git a/rust/src/tftp/tftp.rs b/rust/src/tftp/tftp.rs index 1b093fed256d..3a8b09c202a7 100644 --- a/rust/src/tftp/tftp.rs +++ b/rust/src/tftp/tftp.rs @@ -17,33 +17,33 @@ // written by Clément Galland -use std::str; -use std; -use nom7::IResult; -use nom7::combinator::map_res; use nom7::bytes::streaming::{tag, take_while}; +use nom7::combinator::map_res; use nom7::number::streaming::be_u8; +use nom7::IResult; +use std; +use std::str; -use crate::applayer::{AppLayerTxData,AppLayerStateData}; +use crate::applayer::{AppLayerStateData, AppLayerTxData}; -const READREQUEST: u8 = 1; +const READREQUEST: u8 = 1; const WRITEREQUEST: u8 = 2; -const DATA: u8 = 3; -const ACK: u8 = 4; -const ERROR: u8 = 5; +const DATA: u8 = 3; +const ACK: u8 = 4; +const ERROR: u8 = 5; #[derive(Debug, PartialEq, Eq)] pub struct TFTPTransaction { - pub opcode : u8, - pub filename : String, - pub mode : String, + pub opcode: u8, + pub filename: String, + pub mode: String, id: u64, tx_data: AppLayerTxData, } pub struct TFTPState { state_data: AppLayerStateData, - pub transactions : Vec, + pub transactions: Vec, /// tx counter for assigning incrementing id's to tx's tx_id: u64, } @@ -63,66 +63,65 @@ impl TFTPState { } impl TFTPTransaction { - pub fn new(opcode : u8, filename : String, mode : String) -> TFTPTransaction { + pub fn new(opcode: u8, filename: String, mode: String) -> TFTPTransaction { TFTPTransaction { opcode, filename, - mode : mode.to_lowercase(), - id : 0, + mode: mode.to_lowercase(), + id: 0, tx_data: AppLayerTxData::new(), } } pub fn is_mode_ok(&self) -> bool { match self.mode.as_str() { "netascii" | "mail" | "octet" => true, - _ => false + _ => false, } } pub fn is_opcode_ok(&self) -> bool { match self.opcode { READREQUEST | WRITEREQUEST | ACK | DATA | ERROR => true, - _ => false + _ => false, } } } #[no_mangle] -pub extern "C" fn rs_tftp_state_alloc() -> *mut std::os::raw::c_void { - let state = TFTPState { state_data: AppLayerStateData::new(), transactions : Vec::new(), tx_id: 0, }; +pub extern fn rs_tftp_state_alloc() -> *mut std::os::raw::c_void { + let state = TFTPState { + state_data: AppLayerStateData::new(), + transactions: Vec::new(), + tx_id: 0, + }; let boxed = Box::new(state); return Box::into_raw(boxed) as *mut _; } #[no_mangle] -pub extern "C" fn rs_tftp_state_free(state: *mut std::os::raw::c_void) { +pub extern fn rs_tftp_state_free(state: *mut std::os::raw::c_void) { std::mem::drop(unsafe { Box::from_raw(state as *mut TFTPState) }); } #[no_mangle] -pub extern "C" fn rs_tftp_state_tx_free(state: &mut TFTPState, - tx_id: u64) { +pub extern fn rs_tftp_state_tx_free(state: &mut TFTPState, tx_id: u64) { state.free_tx(tx_id); } #[no_mangle] -pub extern "C" fn rs_tftp_get_tx(state: &mut TFTPState, - tx_id: u64) -> *mut std::os::raw::c_void { +pub extern fn rs_tftp_get_tx(state: &mut TFTPState, tx_id: u64) -> *mut std::os::raw::c_void { match state.get_tx_by_id(tx_id) { Some(tx) => tx as *const _ as *mut _, - None => std::ptr::null_mut(), + None => std::ptr::null_mut(), } } #[no_mangle] -pub extern "C" fn rs_tftp_get_tx_cnt(state: &mut TFTPState) -> u64 { +pub extern fn rs_tftp_get_tx_cnt(state: &mut TFTPState) -> u64 { return state.tx_id; } fn getstr(i: &[u8]) -> IResult<&[u8], &str> { - map_res( - take_while(|c| c != 0), - str::from_utf8 - )(i) + map_res(take_while(|c| c != 0), str::from_utf8)(i) } fn tftp_request(slice: &[u8]) -> IResult<&[u8], TFTPTransaction> { @@ -131,10 +130,10 @@ fn tftp_request(slice: &[u8]) -> IResult<&[u8], TFTPTransaction> { let (i, filename) = getstr(i)?; let (i, _) = tag([0])(i)?; let (i, mode) = getstr(i)?; - Ok((i, - TFTPTransaction::new(opcode, String::from(filename), String::from(mode)) - ) - ) + Ok(( + i, + TFTPTransaction::new(opcode, String::from(filename), String::from(mode)), + )) } fn parse_tftp_request(input: &[u8]) -> Option { @@ -155,9 +154,7 @@ fn parse_tftp_request(input: &[u8]) -> Option { } #[no_mangle] -pub unsafe extern "C" fn rs_tftp_request(state: &mut TFTPState, - input: *const u8, - len: u32) -> i64 { +pub unsafe extern fn rs_tftp_request(state: &mut TFTPState, input: *const u8, len: u32) -> i64 { let buf = std::slice::from_raw_parts(input, len as usize); match parse_tftp_request(buf) { Some(mut tx) => { @@ -165,27 +162,21 @@ pub unsafe extern "C" fn rs_tftp_request(state: &mut TFTPState, tx.id = state.tx_id; state.transactions.push(tx); 0 - }, - None => { - -1 } + None => -1, } } #[no_mangle] -pub unsafe extern "C" fn rs_tftp_get_tx_data( - tx: *mut std::os::raw::c_void) - -> *mut AppLayerTxData -{ +pub unsafe extern fn rs_tftp_get_tx_data(tx: *mut std::os::raw::c_void) -> *mut AppLayerTxData { let tx = cast_pointer!(tx, TFTPTransaction); return &mut tx.tx_data; } #[no_mangle] -pub unsafe extern "C" fn rs_tftp_get_state_data( - state: *mut std::os::raw::c_void) - -> *mut AppLayerStateData -{ +pub unsafe extern fn rs_tftp_get_state_data( + state: *mut std::os::raw::c_void, +) -> *mut AppLayerStateData { let state = cast_pointer!(state, TFTPState); return &mut state.state_data; } @@ -194,25 +185,28 @@ pub unsafe extern "C" fn rs_tftp_get_state_data( mod test { use super::*; static READ_REQUEST: [u8; 20] = [ - 0x00, 0x01, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x00, + 0x00, 0x01, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x6f, + 0x63, 0x74, 0x65, 0x74, 0x00, ]; /* filename not terminated */ static READ_REQUEST_INVALID_1: [u8; 20] = [ - 0x00, 0x01, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x6e, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x00, + 0x00, 0x01, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x6e, 0x6f, + 0x63, 0x74, 0x65, 0x74, 0x00, ]; /* garbage */ - static READ_REQUEST_INVALID_2: [u8; 3] = [ - 0xff, 0xff, 0xff, - ]; + static READ_REQUEST_INVALID_2: [u8; 3] = [0xff, 0xff, 0xff]; static WRITE_REQUEST: [u8; 20] = [ - 0x00, 0x02, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x00, + 0x00, 0x02, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x6f, + 0x63, 0x74, 0x65, 0x74, 0x00, ]; /* filename not terminated */ static INVALID_OPCODE: [u8; 20] = [ - 0x00, 0x06, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x6e, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x00, + 0x00, 0x06, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x6e, 0x6f, + 0x63, 0x74, 0x65, 0x74, 0x00, ]; static INVALID_MODE: [u8; 20] = [ - 0x00, 0x01, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, + 0x00, 0x01, 0x72, 0x66, 0x63, 0x31, 0x33, 0x35, 0x30, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x63, + 0x63, 0x63, 0x63, 0x63, 0x00, ]; #[test] @@ -274,7 +268,6 @@ mod test { #[test] pub fn test_parse_tftp_invalid_mode() { - assert_eq!(None, parse_tftp_request(&INVALID_MODE[..])); } } diff --git a/rust/src/util.rs b/rust/src/util.rs index d7109464f773..cde0a3ee8a49 100644 --- a/rust/src/util.rs +++ b/rust/src/util.rs @@ -21,6 +21,6 @@ use std::ffi::CStr; use std::os::raw::c_char; #[no_mangle] -pub unsafe extern "C" fn rs_check_utf8(val: *const c_char) -> bool { +pub unsafe extern fn rs_check_utf8(val: *const c_char) -> bool { CStr::from_ptr(val).to_str().is_ok() } diff --git a/rust/src/x509/log.rs b/rust/src/x509/log.rs index adb64646a752..3595f94db05f 100644 --- a/rust/src/x509/log.rs +++ b/rust/src/x509/log.rs @@ -28,7 +28,7 @@ use std::os::raw::c_char; /// /// FFI function that dereferences pointers from C. #[no_mangle] -pub unsafe extern "C" fn sc_x509_log_timestamp( +pub unsafe extern fn sc_x509_log_timestamp( jb: &mut JsonBuilder, key: *const c_char, timestamp: i64, ) -> bool { if let Ok(key) = CStr::from_ptr(key).to_str() { diff --git a/rust/src/x509/mod.rs b/rust/src/x509/mod.rs index c87928cf17a8..67b4e563e708 100644 --- a/rust/src/x509/mod.rs +++ b/rust/src/x509/mod.rs @@ -24,8 +24,8 @@ use nom7::Err; use std; use std::os::raw::c_char; use x509_parser::prelude::*; -mod time; mod log; +mod time; #[repr(u32)] pub enum X509DecodeError { @@ -52,10 +52,8 @@ pub struct X509(X509Certificate<'static>); /// /// input must be a valid buffer of at least input_len bytes #[no_mangle] -pub unsafe extern "C" fn rs_x509_decode( - input: *const u8, - input_len: u32, - err_code: *mut u32, +pub unsafe extern fn rs_x509_decode( + input: *const u8, input_len: u32, err_code: *mut u32, ) -> *mut X509 { let slice = std::slice::from_raw_parts(input, input_len as usize); let res = X509Certificate::from_der(slice); @@ -70,7 +68,7 @@ pub unsafe extern "C" fn rs_x509_decode( } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_subject(ptr: *const X509) -> *mut c_char { +pub unsafe extern fn rs_x509_get_subject(ptr: *const X509) -> *mut c_char { if ptr.is_null() { return std::ptr::null_mut(); } @@ -80,7 +78,7 @@ pub unsafe extern "C" fn rs_x509_get_subject(ptr: *const X509) -> *mut c_char { } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_issuer(ptr: *const X509) -> *mut c_char { +pub unsafe extern fn rs_x509_get_issuer(ptr: *const X509) -> *mut c_char { if ptr.is_null() { return std::ptr::null_mut(); } @@ -90,7 +88,7 @@ pub unsafe extern "C" fn rs_x509_get_issuer(ptr: *const X509) -> *mut c_char { } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_serial(ptr: *const X509) -> *mut c_char { +pub unsafe extern fn rs_x509_get_serial(ptr: *const X509) -> *mut c_char { if ptr.is_null() { return std::ptr::null_mut(); } @@ -107,10 +105,8 @@ pub unsafe extern "C" fn rs_x509_get_serial(ptr: *const X509) -> *mut c_char { /// /// ptr must be a valid object obtained using `rs_x509_decode` #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_validity( - ptr: *const X509, - not_before: *mut i64, - not_after: *mut i64, +pub unsafe extern fn rs_x509_get_validity( + ptr: *const X509, not_before: *mut i64, not_after: *mut i64, ) -> i32 { if ptr.is_null() { return -1; @@ -129,7 +125,7 @@ pub unsafe extern "C" fn rs_x509_get_validity( /// /// ptr must be a valid object obtained using `rs_x509_decode` #[no_mangle] -pub unsafe extern "C" fn rs_x509_free(ptr: *mut X509) { +pub unsafe extern fn rs_x509_free(ptr: *mut X509) { if ptr.is_null() { return; } diff --git a/rust/src/x509/time.rs b/rust/src/x509/time.rs index 507b39c5f872..9b77f7339ac2 100644 --- a/rust/src/x509/time.rs +++ b/rust/src/x509/time.rs @@ -37,7 +37,7 @@ pub fn format_timestamp(timestamp: i64) -> Result { /// /// Access buffers from C that are expected to be valid. #[no_mangle] -pub unsafe extern "C" fn sc_x509_format_timestamp( +pub unsafe extern fn sc_x509_format_timestamp( timestamp: i64, buf: *mut c_char, size: usize, ) -> bool { let timestamp = match format_timestamp(timestamp) {