rust: spelling

pull/8828/head
Victor Julien 2 years ago
parent f893827c32
commit ee7ed99b6f

@ -316,7 +316,7 @@ mod tests {
"test that we break on invalid format (missing option)")]
#[test_case("bitstring_overflowabsolute_offset",
DetectAsn1Data::default() => panics r#"Error { input: "absolute_offset", code: Verify }"#;
"test that we break on invalid format (missing seperator)")]
"test that we break on invalid format (missing separator)")]
fn test_asn1_parse_rule(input: &str, expected: DetectAsn1Data) {
let (rest, res) = asn1_parse_rule(input).unwrap();

@ -660,7 +660,7 @@ impl DCERPCState {
}
Err(_) => {
// Error, probably malformed data.
SCLogDebug!("An error occured while parsing DCERPC header");
SCLogDebug!("An error occurred while parsing DCERPC header");
-2
}
}

@ -170,7 +170,7 @@ pub fn parse_dcerpc_bindack(i: &[u8]) -> IResult<&[u8], DCERPCBindAck> {
pub fn parse_bindctx_item(i: &[u8], endianness: Endianness) -> IResult<&[u8], BindCtxItem> {
let (i, ctxid) = u16(endianness)(i)?;
let (i, _num_trans_items) = le_u8(i)?;
let (i, _) = take(1_usize)(i)?; // Reservid bit
let (i, _) = take(1_usize)(i)?; // Reserved bit
let (i, uuid) = take(16_usize)(i)?;
let (i, version) = u16(endianness)(i)?;
let (i, versionminor) = u16(endianness)(i)?;

@ -129,7 +129,7 @@ pub unsafe extern "C" fn SCSha1HashBuffer(
return true;
}
// Start of MD5 C bindins.
// Start of MD5 C bindings.
pub struct SCMd5(Md5);

@ -19,8 +19,8 @@
* \file
* \author Victor Julien <victor@inliniac.net>
*
* Tracks chunk based file transfers. Chunks may be transfered out
* of order, but cannot be transfered in parallel. So only one
* Tracks chunk based file transfers. Chunks may be transferred out
* of order, but cannot be transferred in parallel. So only one
* chunk at a time.
*
* GAP handling. If a data gap is encountered, the file is truncated
@ -226,7 +226,7 @@ impl FileTransferTracker {
self.file_is_truncated = true;
},
_ => {
SCLogDebug!("got error so truncing file");
SCLogDebug!("got error so truncating file");
self.file_is_truncated = true;
},
}
@ -279,7 +279,7 @@ impl FileTransferTracker {
self.file_is_truncated = true;
},
_ => {
SCLogDebug!("got error so truncing file");
SCLogDebug!("got error so truncating file");
self.file_is_truncated = true;
},
}
@ -319,7 +319,7 @@ impl FileTransferTracker {
self.file_is_truncated = true;
},
_ => {
SCLogDebug!("got error so truncing file");
SCLogDebug!("got error so truncating file");
self.file_is_truncated = true;
},
}

@ -412,7 +412,7 @@ fn http2_frames_get_header_firstvalue<'a>(
}
// same as http2_frames_get_header_value but returns a new Vec
// instead of using the transation to store the result slice
// instead of using the transaction to store the result slice
pub fn http2_frames_get_header_value_vec(
tx: &HTTP2Transaction, direction: Direction, name: &str,
) -> Result<Vec<u8>, ()> {

@ -110,7 +110,7 @@ pub enum HTTP2TransactionState {
HTTP2StateDataServer = 5,
HTTP2StateHalfClosedServer = 6,
HTTP2StateClosed = 7,
//not a RFC-defined state, used for stream 0 frames appyling to the global connection
//not a RFC-defined state, used for stream 0 frames applying to the global connection
HTTP2StateGlobal = 8,
//not a RFC-defined state, dropping this old tx because we have too many
HTTP2StateTodrop = 9,

@ -565,7 +565,7 @@ fn http2_parse_headers_block_dynamic_size<'a>(
fn http2_parse_headers_block<'a>(
input: &'a [u8], dyn_headers: &mut HTTP2DynTable,
) -> IResult<&'a [u8], HTTP2FrameHeaderBlock> {
//caller garantees o have at least one byte
//caller guarantees o have at least one byte
if input[0] & 0x80 != 0 {
return http2_parse_headers_block_indexed(input, dyn_headers);
} else if input[0] & 0x40 != 0 {

@ -222,7 +222,7 @@ fn add_proposals(
IkeV2Transform::Auth(ref auth) => {
match *auth {
IkeTransformAuthType::NONE => {
// Note: this could be expected with an AEAD encription alg.
// Note: this could be expected with an AEAD encryption alg.
// See rule 4
}
IkeTransformAuthType::AUTH_HMAC_MD5_96

@ -261,23 +261,23 @@ impl NFSState {
if let RpcRequestCreds::GssApi(ref creds) = r.creds {
if creds.procedure == 0 && creds.service == 2 {
SCLogDebug!("GSS INTEGRITIY: {:?}", creds);
SCLogDebug!("GSS INTEGRITY: {:?}", creds);
match parse_rpc_gssapi_integrity(r.prog_data) {
Ok((_rem, rec)) => {
SCLogDebug!("GSS INTEGRITIY wrapper: {:?}", rec);
SCLogDebug!("GSS INTEGRITY wrapper: {:?}", rec);
data = rec.data;
// store proc and serv for the reply
xidmap.gssapi_proc = creds.procedure;
xidmap.gssapi_service = creds.service;
}
Err(Err::Incomplete(_n)) => {
SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITIY: INCOMPLETE {:?}", _n);
SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITY: INCOMPLETE {:?}", _n);
self.set_event(NFSEvent::MalformedData);
return;
}
Err(Err::Error(_e)) | Err(Err::Failure(_e)) => {
SCLogDebug!(
"NFSPROC4_COMPOUND/GSS INTEGRITIY: Parsing failed: {:?}",
"NFSPROC4_COMPOUND/GSS INTEGRITY: Parsing failed: {:?}",
_e
);
self.set_event(NFSEvent::MalformedData);
@ -389,19 +389,19 @@ impl NFSState {
let mut data = r.prog_data;
if xidmap.gssapi_proc == 0 && xidmap.gssapi_service == 2 {
SCLogDebug!("GSS INTEGRITIY as set by call: {:?}", xidmap);
SCLogDebug!("GSS INTEGRITY as set by call: {:?}", xidmap);
match parse_rpc_gssapi_integrity(r.prog_data) {
Ok((_rem, rec)) => {
SCLogDebug!("GSS INTEGRITIY wrapper: {:?}", rec);
SCLogDebug!("GSS INTEGRITY wrapper: {:?}", rec);
data = rec.data;
}
Err(Err::Incomplete(_n)) => {
SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITIY: INCOMPLETE {:?}", _n);
SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITY: INCOMPLETE {:?}", _n);
self.set_event(NFSEvent::MalformedData);
return;
}
Err(Err::Error(_e)) | Err(Err::Failure(_e)) => {
SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITIY: Parsing failed: {:?}", _e);
SCLogDebug!("NFSPROC4_COMPOUND/GSS INTEGRITY: Parsing failed: {:?}", _e);
self.set_event(NFSEvent::MalformedData);
return;
}

@ -656,7 +656,7 @@ pub enum Nfs4ResponseContent<'a> {
DestroyClientID(u32),
}
// might need improvment with a stateid_present = yes case
// might need improvement with a stateid_present = yes case
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)?;
@ -1443,7 +1443,7 @@ mod tests {
}
#[test]
fn test_nfs4_request_sequenece() {
fn test_nfs4_request_sequence() {
#[rustfmt::skip]
let buf: &[u8] = &[
0x00, 0x00, 0x00, 0x35, /*opcode*/
@ -1469,7 +1469,7 @@ mod tests {
#[rustfmt::skip]
let buf: &[u8] = &[
0x00, 0x00, 0x00, 0x0f, /*opcode*/
0x00, 0x00, 0x00, 0x04, 0x76, 0x6f, 0x6c, 0x31, /*fiename: (vol1)*/
0x00, 0x00, 0x00, 0x04, 0x76, 0x6f, 0x6c, 0x31, /*filename: (vol1)*/
];
let (_, filename_buf) = nfs4_parse_nfsstring(&buf[4..]).unwrap();

@ -333,7 +333,7 @@ fn mcs_req_to_json(mcs: &McsConnectRequest, js: &mut JsonBuilder) -> Result<(),
}
}
// server_selected_procotol not logged
// server_selected_protocol not logged
if let Some(width) = client.desktop_physical_width {
js.set_uint("physical_width", width as u64)?;

@ -177,7 +177,7 @@ impl RdpState {
if self.tls_parsing {
match parse_tls_plaintext(available) {
Ok((remainder, _tls)) => {
// bytes available for futher parsing are what remain
// bytes available for further parsing are what remain
available = remainder;
}
@ -198,7 +198,7 @@ impl RdpState {
match parse_t123_tpkt(available) {
// success
Ok((remainder, t123)) => {
// bytes available for futher parsing are what remain
// bytes available for further parsing are what remain
available = remainder;
// evaluate message within the tpkt
match t123.child {
@ -271,7 +271,7 @@ impl RdpState {
if self.tls_parsing {
match parse_tls_plaintext(available) {
Ok((remainder, tls)) => {
// bytes available for futher parsing are what remain
// bytes available for further parsing are what remain
available = remainder;
for message in &tls.msg {
#[allow(clippy::single_match)]
@ -312,7 +312,7 @@ impl RdpState {
match parse_t123_tpkt(available) {
// success
Ok((remainder, t123)) => {
// bytes available for futher parsing are what remain
// bytes available for further parsing are what remain
available = remainder;
// evaluate message within the tpkt
match t123.child {

@ -216,7 +216,7 @@ fn parse_dcerpc_flags1(i:&[u8]) -> IResult<&[u8],(u8,u8,u8)> {
fn parse_dcerpc_flags2(i:&[u8]) -> IResult<&[u8],(u32,u32,u32)> {
bits(tuple((
take_bits(3u32),
take_bits(1u32), // endianess
take_bits(1u32), // endianness
take_bits(28u32),
)))(i)
}

@ -98,7 +98,7 @@ fn extract_ntlm_substring(i: &[u8], offset: u32, length: u16) -> IResult<&[u8],
pub fn parse_ntlm_auth_record(i: &[u8]) -> IResult<&[u8], NTLMSSPAuthRecord> {
let orig_i = i;
let record_len = i.len() + NTLMSSP_IDTYPE_LEN; // idenfier (8) and type (4) are cut before we are called
let record_len = i.len() + NTLMSSP_IDTYPE_LEN; // identifier (8) and type (4) are cut before we are called
let (i, _lm_blob_len) = verify(le_u16, |&v| (v as usize) < record_len)(i)?;
let (i, _lm_blob_maxlen) = le_u16(i)?;

@ -693,7 +693,7 @@ pub struct SMBState<> {
pub ssn2tree_map: HashMap<SMBCommonHdr, SMBTree>,
// store partial data records that are transfered in multiple
// store partial data records that are transferred in multiple
// requests for DCERPC.
pub ssnguid2vec_map: HashMap<SMBHashKeyHdrGuid, Vec<u8>>,
@ -1923,7 +1923,7 @@ impl SMBState {
for tx in &mut self.transactions {
if !tx.request_done {
SCLogDebug!("TRUNCING TX {} in TOSERVER direction", tx.id);
SCLogDebug!("TRUNCATING TX {} in TOSERVER direction", tx.id);
tx.request_done = true;
}
}
@ -1934,7 +1934,7 @@ impl SMBState {
for tx in &mut self.transactions {
if !tx.response_done {
SCLogDebug!("TRUNCING TX {} in TOCLIENT direction", tx.id);
SCLogDebug!("TRUNCATING TX {} in TOCLIENT direction", tx.id);
tx.response_done = true;
}
}

@ -1131,7 +1131,7 @@ fn smb1_request_record_generic(state: &mut SMBState, r: &SmbRecord, events: Vec<
}
}
/// update or create a tx for a command / reponse pair based
/// update or create a tx for a command / response pair based
/// on the response. We only create a tx for the response side
/// if we didn't already update a tx, and we have to set events
fn smb1_response_record_generic(state: &mut SMBState, r: &SmbRecord, events: Vec<SMBEvent>) {

Loading…
Cancel
Save