impl From<bool> for AppLayerResult {
fn from(v: bool) -> Self {
- if v == false {
+ if !v {
Self::err()
} else {
Self::ok()
SCLogDebug!("post_gap_housekeeping: done");
break;
}
- if tx.req_done == false {
+ if !tx.req_done {
tx.req_lost = true;
}
tx.req_done = true;
SCLogDebug!("post_gap_housekeeping: done");
break;
}
- if tx.req_done == false {
+ if !tx.req_done {
tx.req_lost = true;
}
- if tx.resp_done == false {
+ if !tx.resp_done {
tx.resp_lost = true;
}
tx.req_done = true;
self.bytes_consumed += retval;
// If the query has been completed, clean the buffer and reset the direction
- if self.query_completed == true {
+ if self.query_completed {
self.clean_buffer(direction);
self.reset_direction(direction);
}
fn log_dcerpc_header_tcp(
jsb: &mut JsonBuilder, state: &DCERPCState, tx: &DCERPCTransaction,
) -> Result<(), JsonError> {
- if tx.req_done == true && tx.req_lost == false {
+ if tx.req_done && !tx.req_lost {
jsb.set_string("request", &dcerpc_type_string(tx.req_cmd))?;
match tx.req_cmd {
DCERPC_TYPE_REQUEST => {
jsb.set_string("request", "REQUEST_LOST")?;
}
- if tx.resp_done == true && tx.resp_lost == false {
+ if tx.resp_done && !tx.resp_lost {
jsb.set_string("response", &dcerpc_type_string(tx.resp_cmd))?;
match tx.resp_cmd {
DCERPC_TYPE_RESPONSE => {
fn log_dcerpc_header_udp(
jsb: &mut JsonBuilder, _state: &DCERPCUDPState, tx: &DCERPCTransaction,
) -> Result<(), JsonError> {
- if tx.req_done == true && tx.req_lost == false {
+ if tx.req_done && !tx.req_lost {
jsb.set_string("request", &dcerpc_type_string(tx.req_cmd))?;
match tx.req_cmd {
DCERPC_TYPE_REQUEST => {
jsb.set_string("request", "REQUEST_LOST")?;
}
- if tx.resp_done == true && tx.resp_lost == false {
+ if tx.resp_done && !tx.resp_lost {
jsb.set_string("response", &dcerpc_type_string(tx.resp_cmd))?;
match tx.resp_cmd {
DCERPC_TYPE_RESPONSE => {
}
pub fn is_done(&self) -> bool {
- self.file_open == false
+ !self.file_open
}
fn open(&mut self, config: &'static SuricataFileContext,
}
pub fn create(&mut self, _name: &[u8], _file_size: u64) {
- if self.file_open == true { panic!("close existing file first"); }
+ if self.file_open { panic!("close existing file first"); }
SCLogDebug!("CREATE: name {:?} file_size {}", _name, _file_size);
}
self.fill_bytes = fill_bytes;
self.chunk_is_last = is_last;
- if self.file_open == false {
+ if !self.file_open {
SCLogDebug!("NEW CHUNK: FILE OPEN");
self.track_id = *xid;
self.open(config, files, flags, name);
}
- if self.file_open == true {
+ if self.file_open {
let res = self.update(files, flags, data, 0);
SCLogDebug!("NEW CHUNK: update res {:?}", res);
return res;
if self.chunk_left == 0 && self.fill_bytes == 0 {
//SCLogDebug!("UPDATE: nothing to do");
- if self.chunk_is_last == true {
+ if self.chunk_is_last {
SCLogDebug!("last empty chunk, closing");
self.close(files, flags);
self.chunk_is_last = false;
if self.chunk_left <= data.len() as u32 {
let d = &data[0..self.chunk_left as usize];
- if self.chunk_is_ooo == false {
+ if !self.chunk_is_ooo {
let res = files.file_append(&self.track_id, d, is_gap);
match res {
0 => { },
} else {
self.chunk_left = 0;
- if self.chunk_is_ooo == false {
+ if !self.chunk_is_ooo {
loop {
let _offset = self.tracked;
match self.chunks.remove(&self.tracked) {
self.cur_ooo_chunk_offset = 0;
}
}
- if self.chunk_is_last == true {
+ if self.chunk_is_last {
SCLogDebug!("last chunk, closing");
self.close(files, flags);
self.chunk_is_last = false;
}
} else {
- if self.chunk_is_ooo == false {
+ if !self.chunk_is_ooo {
let res = files.file_append(&self.track_id, data, is_gap);
match res {
0 => { },
ALPROTO_NFS = alproto;
let midstream = conf_get_bool("stream.midstream");
- if midstream == true {
+ if midstream {
if AppLayerProtoDetectPPParseConfPorts(ip_proto_str.as_ptr(), IPPROTO_TCP as u8,
parser.name, ALPROTO_NFS, 0, NFS_MIN_FRAME_LEN,
rs_nfs_probe_ms, rs_nfs_probe_ms) == 0 {
/* if this isn't the first frag, simply update the existing
* tx with the additional stub data */
- if dcer.packet_type == DCERPC_TYPE_REQUEST && dcer.first_frag == false {
+ if dcer.packet_type == DCERPC_TYPE_REQUEST && !dcer.first_frag {
SCLogDebug!("NOT the first frag. Need to find an existing TX");
match parse_dcerpc_request_record(dcer.data, dcer.frag_len, dcer.little_endian) {
Ok((_, recr)) => {
}
},
DCERPC_TYPE_BIND => {
- let brec = if dcer.little_endian == true {
+ let brec = if dcer.little_endian {
parse_dcerpc_bind_record(dcer.data)
} else {
parse_dcerpc_bind_record_big(dcer.data)
if !bindr.ifaces.is_empty() {
let mut ifaces: Vec<DCERPCIface> = Vec::new();
for i in bindr.ifaces {
- let x = if dcer.little_endian == true {
+ 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],
if share_name.is_empty() && !is_pipe {
SCLogDebug!("SMBv2/READ: no tree connect seen, we don't know if we are a pipe");
- if smb_dcerpc_probe(rd.data) == true {
+ if smb_dcerpc_probe(rd.data) {
SCLogDebug!("SMBv2/READ: looks like dcerpc");
// insert fake tree to assist in follow up lookups
let tree = SMBTree::new(b"suricata::dcerpc".to_vec(), true);
if share_name.is_empty() && !is_pipe {
SCLogDebug!("SMBv2/WRITE: no tree connect seen, we don't know if we are a pipe");
- if smb_dcerpc_probe(wr.data) == true {
+ if smb_dcerpc_probe(wr.data) {
SCLogDebug!("SMBv2/WRITE: looks like we have dcerpc");
let tree = SMBTree::new(b"suricata::dcerpc".to_vec(), true);