From 74305c048683ff56ccf28991fd0226d0ad66aa05 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 7 Feb 2020 11:33:30 +0100 Subject: [PATCH] rust/nfs: minor code cleanups --- rust/src/nfs/nfs2.rs | 3 +-- rust/src/nfs/nfs2_records.rs | 2 +- rust/src/nfs/nfs3.rs | 26 +++++++++----------------- rust/src/nfs/nfs4.rs | 2 +- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/rust/src/nfs/nfs2.rs b/rust/src/nfs/nfs2.rs index 7b25bb4239..86f5de81e8 100644 --- a/rust/src/nfs/nfs2.rs +++ b/rust/src/nfs/nfs2.rs @@ -1,4 +1,4 @@ -/* Copyright (C) 2017-2018 Open Information Security Foundation +/* Copyright (C) 2017-2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -125,5 +125,4 @@ impl NFSState { 0 } - } diff --git a/rust/src/nfs/nfs2_records.rs b/rust/src/nfs/nfs2_records.rs index facaadda02..ed5500db1c 100644 --- a/rust/src/nfs/nfs2_records.rs +++ b/rust/src/nfs/nfs2_records.rs @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Open Information Security Foundation +/* Copyright (C) 2017-2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free diff --git a/rust/src/nfs/nfs3.rs b/rust/src/nfs/nfs3.rs index 0398e10cf6..3ca1c0b23c 100644 --- a/rust/src/nfs/nfs3.rs +++ b/rust/src/nfs/nfs3.rs @@ -1,4 +1,4 @@ -/* Copyright (C) 2017-2018 Open Information Security Foundation +/* Copyright (C) 2017-2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -297,24 +297,18 @@ impl NFSState { // store all handle/filename mappings match many0_nfs3_response_readdirplus_entries(d) { Ok((_, ref entries)) => { + SCLogDebug!("READDIRPLUS ENTRIES reply {:?}", entries); for ce in entries { SCLogDebug!("ce {:?}", ce); - match ce.entry { - Some(ref e) => { - SCLogDebug!("e {:?}", e); - match e.handle { - Some(ref h) => { - SCLogDebug!("h {:?}", h); - self.namemap.insert(h.value.to_vec(), e.name_vec.to_vec()); - }, - _ => { }, - } - }, - _ => { }, + if let Some(ref e) = ce.entry { + SCLogDebug!("e {:?}", e); + if let Some(ref h) = e.handle { + SCLogDebug!("h {:?}", h); + self.namemap.insert(h.value.to_vec(), + e.name_vec.to_vec()); + } } } - - SCLogDebug!("READDIRPLUS ENTRIES reply {:?}", entries); }, _ => { self.set_event(NFSEvent::MalformedData); @@ -345,6 +339,4 @@ impl NFSState { 0 } - } - diff --git a/rust/src/nfs/nfs4.rs b/rust/src/nfs/nfs4.rs index f1e527c078..16f06e9ac8 100644 --- a/rust/src/nfs/nfs4.rs +++ b/rust/src/nfs/nfs4.rs @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 Open Information Security Foundation +/* Copyright (C) 2018-2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free