rust/nfs: don't panic on malformed NFS traffic

Instead set events.
pull/3133/head
Nick Price 8 years ago committed by Victor Julien
parent ce59ec5d13
commit 350b5d99ce

@ -95,9 +95,8 @@ pub static mut SURICATA_NFS3_FILE_CONFIG: Option<&'static SuricataFileContext> =
#[repr(u32)]
pub enum NFSEvent {
MalformedData = 0,
/* remove 'Padding' when more events are added. Rustc 1.7 won't
* accept a single field enum with repr(u32) */
Padding,
NonExistingVersion = 1,
UnsupportedVersion = 2,
}
#[derive(Debug)]
@ -1061,15 +1060,24 @@ impl NFSState {
}
match xidmap.progver {
2 => {
SCLogDebug!("NFSv2 reply record");
return self.process_reply_record_v2(r, &xidmap);
},
3 => {
SCLogDebug!("NFSv3 reply record");
return self.process_reply_record_v3(r, &mut xidmap);
},
2 => {
SCLogDebug!("NFSv2 reply record");
return self.process_reply_record_v2(r, &xidmap);
4 => {
SCLogDebug!("NFSv4 unsupported");
self.set_event(NFSEvent::UnsupportedVersion);
return 0;
},
_ => {
SCLogDebug!("Invalid NFS version");
self.set_event(NFSEvent::NonExistingVersion);
return 0;
},
_ => { panic!("unsupported NFS version"); },
}
}

Loading…
Cancel
Save