}
-fn format_addr_hex(input: &Vec<u8>) -> String {
+fn format_addr_hex(input: &[u8]) -> String {
let parts: Vec<String> = input.iter()
.map(|b| format!("{:02x}", b))
.collect();
}
pub fn update(
- &mut self, key_exchange: &String, nonce: &String, transforms: &Vec<Vec<SaAttribute>>,
+ &mut self, key_exchange: &str, nonce: &str, transforms: &Vec<Vec<SaAttribute>>,
) {
- self.key_exchange = key_exchange.clone();
- self.nonce = nonce.clone();
+ self.key_exchange = key_exchange.to_string();
+ self.nonce = nonce.to_string();
if self.nb_transforms == 0 && !transforms.is_empty() {
self.transform.extend(transforms[0].iter().cloned());
}
#![allow(clippy::never_loop)]
#![allow(clippy::new_without_default)]
#![allow(clippy::nonminimal_bool)]
-#![allow(clippy::ptr_arg)]
#![allow(clippy::redundant_pattern_matching)]
#![allow(clippy::result_unit_err)]
#![allow(clippy::single_match)]
strings.join("")
}
*/
-fn nfs_handle2crc(bytes: &Vec<u8>) -> u32 {
+fn nfs_handle2crc(bytes: &[u8]) -> u32 {
let c = crc32::checksum_ieee(bytes);
c
}
/// little wrapper around the FileTransferTracker::new_chunk method
pub fn filetracker_newchunk(ft: &mut FileTransferTracker, files: &mut FileContainer,
- flags: u16, name: &Vec<u8>, data: &[u8],
+ flags: u16, name: &[u8], data: &[u8],
chunk_offset: u64, chunk_size: u32, fill_bytes: u8, is_last: bool, xid: &u32)
{
match unsafe {SURICATA_NFS_FILE_CONFIG} {
}
}
- pub fn new_file_tx(&mut self, file_handle: &Vec<u8>, file_name: &Vec<u8>, direction: Direction)
+ pub fn new_file_tx(&mut self, file_handle: &[u8], file_name: &[u8], direction: Direction)
-> &mut NFSTransaction
{
let mut tx = self.new_tx();
return tx_ref.unwrap();
}
- pub fn get_file_tx_by_handle(&mut self, file_handle: &Vec<u8>, direction: Direction)
+ pub fn get_file_tx_by_handle(&mut self, file_handle: &[u8], direction: Direction)
-> Option<&mut NFSTransaction>
{
let fh = file_handle.to_vec();
fn new_tx_v4<'b>(
&mut self, r: &RpcPacket<'b>, xidmap: &NFSRequestXidMap, procedure: u32,
- _aux_opcodes: &Vec<u32>,
+ _aux_opcodes: &[u32],
) {
let mut tx = self.new_tx();
tx.xid = r.hdr.xid;
/// little wrapper around the FileTransferTracker::new_chunk method
pub fn filetracker_newchunk(ft: &mut FileTransferTracker, files: &mut FileContainer,
- flags: u16, name: &Vec<u8>, data: &[u8],
+ flags: u16, name: &[u8], data: &[u8],
chunk_offset: u64, chunk_size: u32, is_last: bool, xid: &u32)
{
match unsafe {SURICATA_SMB_FILE_CONFIG} {
}
impl SMBState {
- pub fn new_file_tx(&mut self, fuid: &Vec<u8>, file_name: &Vec<u8>, direction: Direction)
+ pub fn new_file_tx(&mut self, fuid: &[u8], file_name: &[u8], direction: Direction)
-> &mut SMBTransaction
{
let mut tx = self.new_tx();
return tx_ref.unwrap();
}
- pub fn get_file_tx_by_fuid(&mut self, fuid: &Vec<u8>, direction: Direction)
+ pub fn get_file_tx_by_fuid(&mut self, fuid: &[u8], direction: Direction)
-> Option<&mut SMBTransaction>
{
let f = fuid.to_vec();
return None;
}
- pub fn new_create_tx(&mut self, file_name: &Vec<u8>,
+ pub fn new_create_tx(&mut self, file_name: &[u8],
disposition: u32, del: bool, dir: bool,
hdr: SMBCommonHdr)
-> &mut SMBTransaction
}
}
-fn smb1_close_file(state: &mut SMBState, fid: &Vec<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);
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.to_vec(),
+ 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);
SMB2_COMMAND_CLOSE => {
match parse_smb2_request_close(r.data) {
Ok((_, cd)) => {
- let found_ts = match state.get_file_tx_by_fuid(&cd.guid.to_vec(), Direction::ToServer) {
+ 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 {
},
None => { false },
};
- let found_tc = match state.get_file_tx_by_fuid(&cd.guid.to_vec(), Direction::ToClient) {
+ 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 {