}
pub fn set_event(&mut self, event: u8) {
- core::sc_app_layer_decoder_events_set_event_raw(&mut self.events, event as u8);
+ core::sc_app_layer_decoder_events_set_event_raw(&mut self.events, event);
}
pub fn update_file_flags(&mut self, state_flags: u16) {
event_name: *mut *const std::os::raw::c_char,
event_type: *mut core::AppLayerEventType,
) -> i8 {
- if let Some(e) = T::from_id(event_id as i32) {
+ if let Some(e) = T::from_id(event_id) {
*event_name = e.to_cstring().as_ptr() as *const std::os::raw::c_char;
*event_type = core::APP_LAYER_EVENT_TYPE_TRANSACTION;
return 0;
}
if AppLayerProtoDetectPMRegisterPatternCS(
- IPPROTO_UDP as u8,
+ IPPROTO_UDP,
ALPROTO_BITTORRENT_DHT,
BITTORRENT_DHT_PAYLOAD_PREFIX.as_ptr() as *const c_char,
BITTORRENT_DHT_PAYLOAD_PREFIX.len() as u16 - 1,
SCLogDebug!("Failed to register protocol detection pattern for direction TOSERVER");
};
if AppLayerProtoDetectPMRegisterPatternCS(
- IPPROTO_UDP as u8,
+ IPPROTO_UDP,
ALPROTO_BITTORRENT_DHT,
BITTORRENT_DHT_PAYLOAD_PREFIX.as_ptr() as *const c_char,
BITTORRENT_DHT_PAYLOAD_PREFIX.len() as u16 - 1,
if unit.is_empty() {
unit = "B";
}
- let unit = get_memunit(unit) as u64;
+ let unit = get_memunit(unit);
if unit == 0 {
return Err("Invalid memory unit");
}
let mut index = 0;
for i in 0..len {
let tx = &self.transactions[i];
- if tx.id as u64 == tx_id { //+ 1 {
+ if tx.id == tx_id { //+ 1 {
found = true;
index = i;
SCLogDebug!("tx {} progress {}/{}", tx.id, tx.req_done, tx.resp_done);
/// * Failure: -1 in case fragment length defined by header mismatches the data.
pub fn handle_common_stub(&mut self, input: &[u8], bytes_consumed: u16, dir: Direction) -> i32 {
let fraglen = self.get_hdr_fraglen().unwrap_or(0);
- if fraglen < bytes_consumed as u16 + DCERPC_HDR_LEN {
+ if fraglen < bytes_consumed + DCERPC_HDR_LEN {
return -1;
}
self.padleft = fraglen - DCERPC_HDR_LEN - bytes_consumed;
#[no_mangle]
pub unsafe extern "C" 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 as u64);
+ SCLogDebug!("freeing tx {}", tx_id);
dce_state.free_tx(tx_id);
}
fn register_pattern_probe() -> i8 {
unsafe {
- if AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP as u8, ALPROTO_DCERPC,
+ 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 as u8, ALPROTO_DCERPC,
+ 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");
let mut index = 0;
for i in 0..len {
let tx = &self.transactions[i];
- if tx.id as u64 == tx_id { //+ 1 {
+ if tx.id == tx_id { //+ 1 {
found = true;
index = i;
SCLogDebug!("tx {} progress {}/{}", tx.id, tx.req_done, tx.resp_done);
state: *mut std::os::raw::c_void, tx_id: u64,
) {
let dce_state = cast_pointer!(state, DCERPCUDPState);
- SCLogDebug!("freeing tx {}", tx_id as u64);
+ SCLogDebug!("freeing tx {}", tx_id);
dce_state.free_tx(tx_id);
}
fn register_pattern_probe() -> i8 {
unsafe {
- if AppLayerProtoDetectPMRegisterPatternCSwPP(core::IPPROTO_UDP as u8, ALPROTO_DCERPC,
+ 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");
if let &Some(ref response) = &tx.response {
for query in &response.queries {
if dns_log_rrtype_enabled(query.rrtype, flags) {
- return dns_log_json_answer(js, response, flags as u64).is_ok();
+ return dns_log_json_answer(js, response, flags).is_ok();
}
}
}
) -> std::os::raw::c_int {
if direction == Direction::ToServer {
for i in 0..tx.frames_ts.len() {
- if tx.frames_ts[i].header.ftype as u8 == value {
+ if tx.frames_ts[i].header.ftype == value {
return 1;
}
}
} else {
for i in 0..tx.frames_tc.len() {
- if tx.frames_tc[i].header.ftype as u8 == value {
+ if tx.frames_tc[i].header.ftype == value {
return 1;
}
}
for i in 0..tx.frames_tc.len() {
match tx.frames_tc[i].data {
HTTP2FrameTypeData::GOAWAY(goaway) => {
- if goaway.errorcode as u32 == code {
+ if goaway.errorcode == code {
return 1;
}
}
HTTP2FrameTypeData::RSTSTREAM(rst) => {
- if rst.errorcode as u32 == code {
+ if rst.errorcode == code {
return 1;
}
}
while !current.is_empty() {
SCLogDebug!("response: handling {}", current.len());
- match parse_message(current, self.protocol_version, self.max_msg_len as usize) {
+ match parse_message(current, self.protocol_version, self.max_msg_len) {
Ok((rem, msg)) => {
SCLogDebug!("response msg {:?}", msg);
if let MQTTOperation::TRUNCATED(ref trunc) = msg.op {
FixedHeader {
message_type: parse_message_type(flags.0),
dup_flag: flags.1 != 0,
- qos_level: flags.2 as u8,
+ qos_level: flags.2,
retain: flags.3 != 0,
remaining_length,
},
username_flag: flags.0 != 0,
password_flag: flags.1 != 0,
will_retain: flags.2 != 0,
- will_qos: flags.3 as u8,
+ will_qos: flags.3,
will_flag: flags.4 != 0,
clean_session: flags.5 != 0,
keepalive,
let s = format!("{:x}", c);
js.set_string("hhash", &s)?;
}
- js.set_uint("id", tx.id as u64)?;
+ js.set_uint("id", tx.id)?;
js.set_bool("file_tx", tx.is_file_tx)?;
Ok(())
}
input_len: u32)
-> AppLayerResult
{
- state.parse_tcp_data_ts_gap(input_len as u32)
+ state.parse_tcp_data_ts_gap(input_len)
}
#[no_mangle]
input_len: u32)
-> AppLayerResult
{
- state.parse_tcp_data_tc_gap(input_len as u32)
+ state.parse_tcp_data_tc_gap(input_len)
}
/// C binding to parse an NFS/UDP request. Returns 1 on success, -1 on failure.
-> u8
{
if i == 0 {
- *procedure = tx.procedure as u32;
+ *procedure = tx.procedure;
return 1;
}
let idx = i as usize - 1;
if idx < tdf.file_additional_procs.len() {
let p = tdf.file_additional_procs[idx];
- *procedure = p as u32;
+ *procedure = p;
return 1;
}
}
let midstream = conf_get_bool("stream.midstream");
if midstream {
- if AppLayerProtoDetectPPParseConfPorts(ip_proto_str.as_ptr(), IPPROTO_TCP as u8,
+ 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 as u8,
+ 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 as u8,
+ AppLayerProtoDetectPPRegister(IPPROTO_TCP,
default_port.as_ptr(), ALPROTO_NFS, 0,
NFS_MIN_FRAME_LEN, Direction::ToServer.into(),
rs_nfs_probe, rs_nfs_probe);
let alproto = AppLayerRegisterProtocolDetection(&parser, 1);
ALPROTO_NFS = alproto;
- if AppLayerProtoDetectPPParseConfPorts(ip_proto_str.as_ptr(), IPPROTO_UDP as u8,
+ 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 as u8,
+ 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);
/// Complete data expected
fn parse_nfs3_data_complete(i: &[u8], file_len: usize, fill_bytes: usize) -> IResult<&[u8], &[u8]> {
- let (i, file_data) = take(file_len as usize)(i)?;
+ let (i, file_data) = take(file_len)(i)?;
let (i, _) = cond(fill_bytes > 0, take(fill_bytes))(i)?;
Ok((i, file_data))
}
/// Partial data. We have all file_len, but need to consider fill_bytes
fn parse_nfs3_data_partial(i: &[u8], file_len: usize, fill_bytes: usize) -> IResult<&[u8], &[u8]> {
- let (i, file_data) = take(file_len as usize)(i)?;
- let fill_bytes = cmp::min(fill_bytes as usize, i.len());
+ let (i, file_data) = take(file_len)(i)?;
+ let fill_bytes = cmp::min(fill_bytes, i.len());
let (i, _) = cond(fill_bytes > 0, take(fill_bytes))(i)?;
Ok((i, file_data))
}
}
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 as u32 - 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]) {
let (i, verifier) = take(verifier_len as usize)(i)?;
let consumed = start_i.len() - i.len();
- if consumed > rec_size as usize {
+ if consumed > rec_size {
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 - consumed) as u32;
let (i, prog_data) = if !complete {
rest(i)?
} else {
}
}
params.remove(index);
- if user.value.len() == 0 {
+ if user.value.is_empty() {
return Err(Err::Error(make_error(i, ErrorKind::Tag)));
}
return Ok((i, PgsqlStartupParameters{
SCLogError!("Invalid depth value");
}
}
- AppLayerParserSetStreamDepth(IPPROTO_TCP as u8, ALPROTO_PGSQL, stream_depth)
+ AppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_PGSQL, stream_depth)
}
if let Some(val) = conf_get("app-layer.protocols.pgsql.max-tx") {
if let Ok(v) = val.parse::<usize>() {
match vercmd.get_version() {
2 => {
let (_, cmd2) = vercmd.get_smb2_cmd();
- let x = match cmd2 as u16 {
+ let x = match cmd2 {
SMB2_COMMAND_READ => { 0 },
SMB2_COMMAND_WRITE => { 0 },
SMB2_COMMAND_IOCTL => { self.msg_id },
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 as u64, hdr.tree_id as u32, 0_u64), guid.to_vec());
+ 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(),
fn smb_common_header(jsb: &mut JsonBuilder, state: &SMBState, tx: &SMBTransaction) -> Result<(), JsonError>
{
- jsb.set_uint("id", tx.id as u64)?;
+ jsb.set_uint("id", tx.id)?;
if state.dialect != 0 {
let dialect = &smb2_dialect_string(state.dialect);
}
- jsb.set_uint("session_id", tx.hdr.ssn_id as u64)?;
+ jsb.set_uint("session_id", tx.hdr.ssn_id)?;
jsb.set_uint("tree_id", tx.hdr.tree_id as u64)?;
debug_add_progress(jsb, tx)?;
};
let msg_id = match rec_type {
SMBHDR_TYPE_TRANS_FRAG | SMBHDR_TYPE_SHARE => { 0 },
- _ => { r.message_id as u64 },
+ _ => { r.message_id },
};
SMBCommonHdr {
// 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 as u64 },
+ _ => { r.message_id },
};
SMBCommonHdr {
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) as i64, 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);
}
}
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) as i64, 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);
}
}
consumed -= 3;
}
SCLogDebug!("smb record NOT found");
- return AppLayerResult::incomplete(consumed as u32, 8);
+ return AppLayerResult::incomplete(consumed, 8);
},
}
}
SCLogDebug!("setting consumed {} need {} needed {:?} total input {}",
total_consumed, n, needed, stream_slice.len());
let need = n;
- return AppLayerResult::incomplete(total_consumed as u32, need as u32);
+ return AppLayerResult::incomplete(total_consumed, need as u32);
}
// tracking a write record, which we don't need to
// queue up at the stream level, but can feed to us
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) as i64,
+ 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);
}
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) as i64, 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);
}
}
consumed -= 3;
}
SCLogDebug!("smb record NOT found");
- return AppLayerResult::incomplete(consumed as u32, 8);
+ return AppLayerResult::incomplete(consumed, 8);
},
}
}
SCLogDebug!("setting consumed {} need {} needed {:?} total input {}",
total_consumed, n, needed, stream_slice.len());
let need = n;
- return AppLayerResult::incomplete(total_consumed as u32, need as u32);
+ return AppLayerResult::incomplete(total_consumed, need as u32);
}
// tracking a read record, which we don't need to
// queue up at the stream level, but can feed to us
input_len: u32)
-> AppLayerResult
{
- state.parse_tcp_data_ts_gap(input_len as u32)
+ state.parse_tcp_data_ts_gap(input_len)
}
input_len: u32)
-> AppLayerResult
{
- state.parse_tcp_data_tc_gap(input_len as u32)
+ state.parse_tcp_data_tc_gap(input_len)
}
fn smb_probe_tcp_midstream(direction: Direction, slice: &[u8], rdir: *mut u8, begins: bool) -> i8
tx_id: u64)
{
let state = cast_pointer!(state, SMBState);
- SCLogDebug!("freeing tx {}", tx_id as u64);
+ SCLogDebug!("freeing tx {}", tx_id);
state.free_tx(tx_id);
}
let mut r = 0;
unsafe {
// SMB1
- r |= AppLayerProtoDetectPMRegisterPatternCSwPP(IPPROTO_TCP as u8, ALPROTO_SMB,
+ 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 as u8, ALPROTO_SMB,
+ 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 as u8, ALPROTO_SMB,
+ 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 as u8, ALPROTO_SMB,
+ 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 as u8, ALPROTO_SMB,
+ 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 as u8, ALPROTO_SMB,
+ 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);
}
}
let have_cfg = AppLayerProtoDetectPPParseConfPorts(ip_proto_str.as_ptr(),
- IPPROTO_TCP as u8, parser.name, ALPROTO_SMB, 0,
+ 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 as u8, default_port.as_ptr(), ALPROTO_SMB,
+ 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);
}
Err(_) => { SCLogError!("Invalid depth value"); }
}
}
- AppLayerParserSetStreamDepth(IPPROTO_TCP as u8, ALPROTO_SMB, stream_depth);
+ 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) {
let (i, file_data) = rest(i)?;
let record = Smb1WriteRequestRecord {
offset: high_offset.map(|ho| (ho as u64) << 32 | offset as u64).unwrap_or(0),
- len: (((data_len_high as u32) << 16) as u32)|(data_len_low as u32),
+ len: ((data_len_high as u32) << 16)|(data_len_low as u32),
fid,
data: file_data,
};
let (i, file_data) = rest(i)?;
let record = SmbResponseReadAndXRecord {
- len: (((data_len_high as u32) << 16)|data_len_low as u32),
+ len: ((data_len_high << 16)|data_len_low as u32),
data: file_data,
};
Ok((i, record))
{
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 as u16, &tx_hdr);
+ let tx = state.get_generic_tx(2, r.command, &tx_hdr);
if let Some(tx) = tx {
tx.set_status(r.nt_status, false);
tx.response_done = true;
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 as u32;
+ tdn.tree_id = r.tree_id;
share_name = tdn.share_name.to_vec();
}
// update hdr now that we have a tree_id
#[no_mangle]
pub unsafe extern "C" fn rs_snmp_tx_get_version(tx: &mut SNMPTransaction, version: *mut u32) {
debug_assert!(tx.version != 0, "SNMP version is 0");
- *version = tx.version as u32;
+ *version = tx.version;
}
#[no_mangle]
pub unsafe extern "C" 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 as u32;
+ *pdu_type = info.pdu_type.0;
}
None => {
*pdu_type = 0xffffffff;
hdr.record_left_msg = parser::MessageCode::Kexinit;
return AppLayerResult::incomplete(
(il - rem.len()) as u32,
- (head.pkt_len - 2) as u32
+ head.pkt_len - 2
);
}
else {
#[no_mangle]
pub extern "C" fn rs_tftp_get_tx_cnt(state: &mut TFTPState) -> u64 {
- return state.tx_id as u64;
+ return state.tx_id;
}
fn getstr(i: &[u8]) -> IResult<&[u8], &str> {