smb: do not rely on one valid NBSS byte for probing

Need to have the SMB header so as to validate
pull/5627/head
Philippe Antoine 6 years ago committed by Victor Julien
parent 48f0c612e3
commit 6181459086

@ -44,6 +44,9 @@ impl<'a> NbssRecord<'a> {
}; };
valid valid
} }
pub fn needs_more(&self) -> bool {
return self.is_valid() && self.length >= 4 && self.data.len() < 4;
}
pub fn is_smb(&self) -> bool { pub fn is_smb(&self) -> bool {
let valid = self.is_valid(); let valid = self.is_valid();
let smb = if self.data.len() >= 4 && let smb = if self.data.len() >= 4 &&

@ -1977,9 +1977,8 @@ pub extern "C" fn rs_smb_probe_tcp(direction: u8,
if hdr.is_smb() { if hdr.is_smb() {
SCLogDebug!("smb found"); SCLogDebug!("smb found");
return 1; return 1;
} else if hdr.is_valid() { } else if hdr.needs_more(){
SCLogDebug!("nbss found, assume smb"); return 0;
return 1;
} }
}, },
_ => { }, _ => { },

Loading…
Cancel
Save